@Test public void saveRestore1() { Memento memento = new Memento(); setUpSlots(configuration); setUpSlots(restoredConfiguration); when(configuration.getCurrentResolver(slots[0])).thenReturn(resolver); when(resolver.getId()).thenReturn(RESOLVER_ID); when(persistenceManager.save(resolver)).thenReturn(memento); when(persistenceManager.restore(memento)).thenReturn(restoredResolver); underTest.restore(restoredConfiguration, underTest.save(configuration)); verify(restoredConfiguration, times(1)).setCurrentResolver(slots[0], restoredResolver); }
private void setUpSlots(ManagedSlotMappingConfiguration configuration2) { when(configuration2.getSlots()).thenReturn(slots); when(configuration2.isConfigured(slots[0])).thenReturn(true); when(configuration2.getSlotById(SLOT_ID)).thenReturn(slots[0]); }