Commit 98f3da28 authored by yogevbd's avatar yogevbd

Fix android unit tests

parent e6f3d7e8
...@@ -21,11 +21,11 @@ public class PushNotificationProps { ...@@ -21,11 +21,11 @@ public class PushNotificationProps {
} }
public String getTitle() { public String getTitle() {
return mBundle.getString("title", ""); return mBundle.getString("title");
} }
public String getBody() { public String getBody() {
return mBundle.getString("body", ""); return mBundle.getString("body");
} }
public Bundle asBundle() { public Bundle asBundle() {
......
...@@ -6,6 +6,8 @@ import android.app.NotificationManager; ...@@ -6,6 +6,8 @@ import android.app.NotificationManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReactContext;
...@@ -54,6 +56,8 @@ public class PushNotificationTest { ...@@ -54,6 +56,8 @@ public class PushNotificationTest {
@Mock private AppLifecycleFacade mAppLifecycleFacade; @Mock private AppLifecycleFacade mAppLifecycleFacade;
@Mock private AppLaunchHelper mAppLaunchHelper; @Mock private AppLaunchHelper mAppLaunchHelper;
@Mock private JsIOHelper mJsIOHelper; @Mock private JsIOHelper mJsIOHelper;
@Mock private Resources mResources;
@Mock private PackageManager mPackageManager;
@Before @Before
public void setup() throws Exception { public void setup() throws Exception {
...@@ -68,7 +72,8 @@ public class PushNotificationTest { ...@@ -68,7 +72,8 @@ public class PushNotificationTest {
ApplicationInfo ai = mock(ApplicationInfo.class); ApplicationInfo ai = mock(ApplicationInfo.class);
when(mContext.getApplicationInfo()).thenReturn(ai); when(mContext.getApplicationInfo()).thenReturn(ai);
when(mContext.getResources()).thenReturn(mResources);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mContext.getSystemService(Context.NOTIFICATION_SERVICE)).thenReturn(mNotificationManager); when(mContext.getSystemService(Context.NOTIFICATION_SERVICE)).thenReturn(mNotificationManager);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment