8
8
import android .os .Bundle ;
9
9
import android .util .Log ;
10
10
11
- import com .azure .reactnative .notificationhub .NotificationChannelBuilder ;
12
- import com .azure .reactnative .notificationhub .NotificationHubUtil ;
11
+ import com .azure .reactnative .notificationhub .ReactNativeNotificationChannelBuilder ;
12
+ import com .azure .reactnative .notificationhub .ReactNativeNotificationHubUtil ;
13
13
import com .azure .reactnative .notificationhub .ReactNativeFirebaseMessagingService ;
14
14
import com .azure .reactnative .notificationhub .ReactNativeNotificationsHandler ;
15
15
import com .azure .reactnative .notificationhub .ReactNativeRegistrationIntentService ;
26
26
import org .powermock .modules .junit4 .PowerMockRunner ;
27
27
import org .powermock .reflect .Whitebox ;
28
28
29
- import static com .azure .reactnative .notificationhub .Constants .*;
29
+ import static com .azure .reactnative .notificationhub .ReactNativeConstants .*;
30
30
import static org .mockito .ArgumentMatchers .any ;
31
31
import static org .mockito .ArgumentMatchers .anyBoolean ;
32
32
import static org .mockito .ArgumentMatchers .anyInt ;
43
43
*/
44
44
@ RunWith (PowerMockRunner .class )
45
45
@ PrepareForTest ({
46
- NotificationHubUtil .class ,
46
+ ReactNativeNotificationHubUtil .class ,
47
47
ReactNativeNotificationsHandler .class ,
48
48
ReactNativeRegistrationIntentService .class ,
49
- NotificationChannelBuilder .Factory .class ,
50
- NotificationHubUtil .IntentFactory .class ,
49
+ ReactNativeNotificationChannelBuilder .Factory .class ,
50
+ ReactNativeNotificationHubUtil .IntentFactory .class ,
51
51
Build .VERSION .class ,
52
52
FirebaseMessagingService .class ,
53
53
RemoteMessage .class ,
@@ -58,7 +58,7 @@ public class ReactNativeFirebaseMessagingServiceTest {
58
58
ReactApplicationContext mReactApplicationContext ;
59
59
60
60
@ Mock
61
- NotificationHubUtil mHubUtil ;
61
+ ReactNativeNotificationHubUtil mHubUtil ;
62
62
63
63
@ Mock
64
64
NotificationManager mNotificationManager ;
@@ -72,12 +72,12 @@ public void setUp() {
72
72
reset (mReactApplicationContext );
73
73
74
74
// Prepare mock objects
75
- PowerMockito .mockStatic (NotificationHubUtil .class );
76
- when (NotificationHubUtil .getInstance ()).thenReturn (mHubUtil );
75
+ PowerMockito .mockStatic (ReactNativeNotificationHubUtil .class );
76
+ when (ReactNativeNotificationHubUtil .getInstance ()).thenReturn (mHubUtil );
77
77
PowerMockito .mockStatic (ReactNativeNotificationsHandler .class );
78
78
PowerMockito .mockStatic (ReactNativeRegistrationIntentService .class );
79
- PowerMockito .mockStatic (NotificationChannelBuilder .Factory .class );
80
- PowerMockito .mockStatic (NotificationHubUtil .IntentFactory .class );
79
+ PowerMockito .mockStatic (ReactNativeNotificationChannelBuilder .Factory .class );
80
+ PowerMockito .mockStatic (ReactNativeNotificationHubUtil .IntentFactory .class );
81
81
PowerMockito .suppress (methodsDeclaredIn (FirebaseMessagingService .class ));
82
82
PowerMockito .mockStatic (Log .class );
83
83
when (mReactApplicationContext .getSystemService (Context .NOTIFICATION_SERVICE )).thenReturn (
@@ -97,8 +97,8 @@ public void setUp() {
97
97
public void testCreateNotificationChannelBelowVersionO () {
98
98
final int sdkVersion = Build .VERSION_CODES .LOLLIPOP ;
99
99
100
- NotificationChannelBuilder builder = PowerMockito .mock (NotificationChannelBuilder .class );
101
- when (NotificationChannelBuilder .Factory .create ()).thenReturn (builder );
100
+ ReactNativeNotificationChannelBuilder builder = PowerMockito .mock (ReactNativeNotificationChannelBuilder .class );
101
+ when (ReactNativeNotificationChannelBuilder .Factory .create ()).thenReturn (builder );
102
102
when (mHubUtil .hasChannelImportance (mReactApplicationContext )).thenReturn (false );
103
103
when (mHubUtil .hasChannelShowBadge (mReactApplicationContext )).thenReturn (false );
104
104
when (mHubUtil .hasChannelEnableLights (mReactApplicationContext )).thenReturn (false );
@@ -124,8 +124,8 @@ public void testCreateNotificationChannel() {
124
124
final boolean channelEnableVibration = true ;
125
125
final int sdkVersion = Build .VERSION_CODES .O ;
126
126
127
- NotificationChannelBuilder builder = PowerMockito .mock (NotificationChannelBuilder .class );
128
- when (NotificationChannelBuilder .Factory .create ()).thenReturn (builder );
127
+ ReactNativeNotificationChannelBuilder builder = PowerMockito .mock (ReactNativeNotificationChannelBuilder .class );
128
+ when (ReactNativeNotificationChannelBuilder .Factory .create ()).thenReturn (builder );
129
129
NotificationChannel channel = PowerMockito .mock (NotificationChannel .class );
130
130
when (channel .getId ()).thenReturn (NOTIFICATION_CHANNEL_ID );
131
131
when (builder .build ()).thenReturn (channel );
@@ -161,8 +161,8 @@ public void testDeleteNotificationChannel() {
161
161
Whitebox .setInternalState (Build .VERSION .class , "SDK_INT" , sdkVersion );
162
162
163
163
// Prepare channel
164
- NotificationChannelBuilder builder = PowerMockito .mock (NotificationChannelBuilder .class );
165
- when (NotificationChannelBuilder .Factory .create ()).thenReturn (builder );
164
+ ReactNativeNotificationChannelBuilder builder = PowerMockito .mock (ReactNativeNotificationChannelBuilder .class );
165
+ when (ReactNativeNotificationChannelBuilder .Factory .create ()).thenReturn (builder );
166
166
NotificationChannel channel = PowerMockito .mock (NotificationChannel .class );
167
167
when (channel .getId ()).thenReturn (NOTIFICATION_CHANNEL_ID );
168
168
when (builder .build ()).thenReturn (channel );
@@ -180,8 +180,8 @@ public void testOnNewToken() {
180
180
181
181
mMessagingService .onNewToken (token );
182
182
183
- verifyStatic (NotificationHubUtil .IntentFactory .class );
184
- NotificationHubUtil .IntentFactory .createIntent (
183
+ verifyStatic (ReactNativeNotificationHubUtil .IntentFactory .class );
184
+ ReactNativeNotificationHubUtil .IntentFactory .createIntent (
185
185
any (), eq (ReactNativeRegistrationIntentService .class ));
186
186
}
187
187
@@ -195,8 +195,8 @@ public void testOnMessageReceivedForeground() {
195
195
when (mHubUtil .getAppIsForeground ()).thenReturn (true );
196
196
197
197
// Prepare channel
198
- NotificationChannelBuilder builder = PowerMockito .mock (NotificationChannelBuilder .class );
199
- when (NotificationChannelBuilder .Factory .create ()).thenReturn (builder );
198
+ ReactNativeNotificationChannelBuilder builder = PowerMockito .mock (ReactNativeNotificationChannelBuilder .class );
199
+ when (ReactNativeNotificationChannelBuilder .Factory .create ()).thenReturn (builder );
200
200
NotificationChannel channel = PowerMockito .mock (NotificationChannel .class );
201
201
when (channel .getId ()).thenReturn (NOTIFICATION_CHANNEL_ID );
202
202
when (builder .build ()).thenReturn (channel );
@@ -224,8 +224,8 @@ public void testOnMessageReceivedBackground() {
224
224
when (mHubUtil .getAppIsForeground ()).thenReturn (false );
225
225
226
226
// Prepare channel
227
- NotificationChannelBuilder builder = PowerMockito .mock (NotificationChannelBuilder .class );
228
- when (NotificationChannelBuilder .Factory .create ()).thenReturn (builder );
227
+ ReactNativeNotificationChannelBuilder builder = PowerMockito .mock (ReactNativeNotificationChannelBuilder .class );
228
+ when (ReactNativeNotificationChannelBuilder .Factory .create ()).thenReturn (builder );
229
229
NotificationChannel channel = PowerMockito .mock (NotificationChannel .class );
230
230
when (channel .getId ()).thenReturn (NOTIFICATION_CHANNEL_ID );
231
231
when (builder .build ()).thenReturn (channel );
0 commit comments