Skip to content

Commit

Permalink
Add a normal non-Bundleable object to retained object test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuinden committed Mar 8, 2021
1 parent ab7ebae commit 514c68b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -934,10 +934,12 @@ class InvalidObject {
TestObject testObject = new TestObject();
TestObject testPendingObject = new TestObject();
TestObject testRemovedObject = new TestObject();
Object testNormalObject = new Object();

backstack.addRetainedObject("testObject", testObject);
backstack.addRetainedObject("testPendingObject", testPendingObject);
backstack.addRetainedObject("testRemovedObject", testRemovedObject);
backstack.addRetainedObject("testNormalObject", testNormalObject);

assertThat(testObject.currentState).isEqualTo(3);
assertThat(testPendingObject.currentState).isEqualTo(3);
Expand All @@ -963,6 +965,8 @@ public void handleStateChange(@Nonnull StateChange stateChange, @Nonnull StateCh
backstack2.fromBundle(bundle);
assertThat(testObject.currentState).isEqualTo(5);

backstack2.addRetainedObject("testNormalObject", testNormalObject);

try {
backstack2.addRetainedObject("testPendingObject", new InvalidObject());
Assert.fail();
Expand Down

0 comments on commit 514c68b

Please sign in to comment.