@@ -110,6 +110,20 @@ public void testImmutableKeys() {
110
110
}
111
111
}
112
112
113
+ @ Test (expected = RuntimeException .class )
114
+ public void testInstallationObjectIdCannotBeChanged () throws Exception {
115
+ boolean hasException = false ;
116
+ ParseInstallation installation = new ParseInstallation ();
117
+ try {
118
+ installation .put ("objectId" , "abc" );
119
+ } catch (IllegalArgumentException e ) {
120
+ assertTrue (e .getMessage ().contains ("Cannot modify" ));
121
+ hasException = true ;
122
+ }
123
+ assertTrue (hasException );
124
+ installation .setObjectId ("abc" );
125
+ }
126
+
113
127
@ Test
114
128
public void testSaveAsync () throws Exception {
115
129
String sessionToken = "sessionToken" ;
@@ -323,19 +337,7 @@ public void testLocaleIdentifierSpecialCases() throws Exception {
323
337
assertEquals ("en" , installation .getString (KEY_LOCALE_IDENTIFIER ));
324
338
}
325
339
326
- @ Test (expected = RuntimeException .class )
327
- public void testSetObjectId () throws Exception {
328
- ParseCurrentInstallationController controller =
329
- mock (ParseCurrentInstallationController .class );
330
- ParseInstallation currentInstallation = new ParseInstallation ();
331
- when (controller .getAsync ()).thenReturn (Task .forResult (currentInstallation ));
332
- ParseCorePlugins .getInstance ().registerCurrentInstallationController (controller );
333
340
334
- ParseInstallation installation = ParseInstallation .getCurrentInstallation ();
335
- assertNotNull (installation );
336
- verify (controller , times (1 )).getAsync ();
337
- installation .setObjectId (null );
338
- }
339
341
340
342
// TODO(mengyan): Add testFetchAsync, right now we can not test super methods inside
341
343
// testFetchAsync
0 commit comments