From 514c68b5f944155b9f8a4a853c18cecb4dcd930e Mon Sep 17 00:00:00 2001 From: Zhuinden Date: Mon, 8 Mar 2021 04:58:30 +0100 Subject: [PATCH] Add a normal non-Bundleable object to retained object test --- .../src/test/java/com/zhuinden/simplestack/BackstackTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simple-stack/src/test/java/com/zhuinden/simplestack/BackstackTest.java b/simple-stack/src/test/java/com/zhuinden/simplestack/BackstackTest.java index 147df130..39fe7624 100644 --- a/simple-stack/src/test/java/com/zhuinden/simplestack/BackstackTest.java +++ b/simple-stack/src/test/java/com/zhuinden/simplestack/BackstackTest.java @@ -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); @@ -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();