### Question:
NestedPersistentStateManager implements PersistentStateManager, PersistentStateInterface { @Override public synchronized void stopManaging(String objectName) { refresh(objectName); synchronized (mManagedObjects) { PersistentStateInterface objectInstance = mManagedObjects.get(objectName); objectInstance.setPersistentStateListener(null); mManagedObjects.remove(objectName); } }  @Override Map<String, Object> copyPersistentState(); @Override void initWithPersistentState(@Nullable Map<String, Object> persistentState); @Override void setPersistentStateListener(@Nullable PersistentStateListener listener); @Override synchronized void startManaging(
            String objectName, PersistentStateInterface objectInstance); @Override synchronized void stopManaging(String objectName); @Override void refresh(String objectName); @Override void refresh(); @Override void reset(String objectName); @Override void reset(); @Override void flush(); @Override void close();  }### Answer:
@Test void stopManaging() throws Exception { Map<String, Object> state = new HashMap<>(); String obj1String; String obj2String; { TestIface obj1 = new TestIface(); TestIface obj2 = new TestIface(); NestedPersistentStateManager persistentStateManager = new NestedPersistentStateManager(); persistentStateManager.initWithPersistentState(state); persistentStateManager.startManaging("obj1", obj1); persistentStateManager.startManaging("obj2", obj2); obj1String = PARAM_WHOAMI_KEY.getFromMap(obj1.mMap); obj2String = PARAM_WHOAMI_KEY.getFromMap(obj2.mMap); assertEquals("Fresh", PARAM_STRING_KEY.getFromMap(obj1.mMap)); assertEquals("Fresh", PARAM_STRING_KEY.getFromMap(obj2.mMap)); state = persistentStateManager.copyPersistentState(); persistentStateManager.close(); } { TestIface obj1 = new TestIface(); TestIface obj2 = new TestIface(); NestedPersistentStateManager persistentStateManager = new NestedPersistentStateManager(); persistentStateManager.initWithPersistentState(state); persistentStateManager.startManaging("obj1", obj1); persistentStateManager.startManaging("obj2", obj2); assertEquals(obj1String, PARAM_WHOAMI_KEY.getFromMap(obj1.mMap)); assertEquals(obj2String, PARAM_WHOAMI_KEY.getFromMap(obj2.mMap)); assertEquals("Not fresh", PARAM_STRING_KEY.getFromMap(obj1.mMap)); assertEquals("Not fresh", PARAM_STRING_KEY.getFromMap(obj2.mMap)); persistentStateManager.stopManaging("obj2"); obj2.increment(); state = persistentStateManager.copyPersistentState(); persistentStateManager.close(); } { TestIface obj1 = new TestIface(); TestIface obj2 = new TestIface(); NestedPersistentStateManager persistentStateManager = new NestedPersistentStateManager(); persistentStateManager.initWithPersistentState(state); persistentStateManager.startManaging("obj1", obj1); persistentStateManager.startManaging("obj2", obj2); assertEquals(obj1String, PARAM_WHOAMI_KEY.getFromMap(obj1.mMap)); assertEquals(obj2String, PARAM_WHOAMI_KEY.getFromMap(obj2.mMap)); assertEquals("Not fresh", PARAM_STRING_KEY.getFromMap(obj1.mMap)); assertEquals("Not fresh", PARAM_STRING_KEY.getFromMap(obj2.mMap)); assertEquals((Object) 1, PARAM_INTEGER_KEY.getFromMap(obj2.mMap)); state = persistentStateManager.copyPersistentState(); persistentStateManager.close(); } }