22
22
import org .robolectric .android .controller .ActivityController ;
23
23
import org .robolectric .annotation .Config ;
24
24
import org .robolectric .shadows .ShadowLog ;
25
- import org .robolectric .shadows .ShadowNotificationManager ;
26
25
27
26
import static com .onesignal .OneSignalPackagePrivateHelper .NotificationChannelManager_createNotificationChannel ;
28
27
import static com .onesignal .OneSignalPackagePrivateHelper .NotificationChannelManager_processChannelList ;
38
37
ShadowOSUtils .class ,
39
38
ShadowRoboNotificationManager .class },
40
39
instrumentedPackages = {"com.onesignal" },
41
- sdk = 10000 )
40
+ sdk = 26 )
42
41
@ RunWith (RobolectricTestRunner .class )
43
42
public class NotificationChannelManagerRunner {
44
43
@@ -81,7 +80,7 @@ public void createNotificationChannelCreateBasicChannel() throws Exception {
81
80
JSONObject payload = new JSONObject ();
82
81
JSONObject chnl = new JSONObject ();
83
82
chnl .put ("id" , "test_id" );
84
- payload .put ("chnl" , chnl );
83
+ payload .put ("chnl" , chnl . toString () );
85
84
86
85
String ret = NotificationChannelManager_createNotificationChannel (blankActivity , payload );
87
86
@@ -114,7 +113,7 @@ public void createNotificationChannelWithALlOptions() throws Exception {
114
113
payload .put ("bdg" , 1 );
115
114
payload .put ("bdnd" , 1 );
116
115
117
- payload .put ("chnl" , chnl );
116
+ payload .put ("chnl" , chnl . toString () );
118
117
119
118
String ret = NotificationChannelManager_createNotificationChannel (blankActivity , payload );
120
119
@@ -146,7 +145,7 @@ public void useOtherChannelWhenItIsAvailable() throws Exception {
146
145
147
146
JSONObject chnl = new JSONObject ();
148
147
chnl .put ("id" , "test_id" );
149
- payload .put ("chnl" , chnl );
148
+ payload .put ("chnl" , chnl . toString () );
150
149
151
150
String ret = NotificationChannelManager_createNotificationChannel (blankActivity , payload );
152
151
@@ -159,6 +158,9 @@ public void useOtherChannelWhenItIsAvailable() throws Exception {
159
158
assertEquals ("existing_id" , ret );
160
159
}
161
160
161
+
162
+ // Starting cold start sync tests
163
+
162
164
@ Test
163
165
public void processPayloadWithOutChannelList () throws Exception {
164
166
createChannel ("local_existing_id" );
@@ -226,6 +228,8 @@ public void processChannelListWithMultiLanguage() throws Exception {
226
228
assertEquals ("en_grp_nm" , ShadowRoboNotificationManager .lastChannelGroup .getName ());
227
229
}
228
230
231
+ // Starting helper methods
232
+
229
233
JSONObject createBasicChannelListPayload () throws JSONException {
230
234
createChannel ("local_existing_id" );
231
235
createChannel ("OS_existing_id" );
0 commit comments