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