@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); }
@Before public void setUp() { MockitoAnnotations.initMocks(this); slots = new Slot[] {new Slot(SLOT_ID, "n1", DataType.TEXT)}; when(persistenceManager.getId()).thenReturn(RESOLVER_ID); underTest = new ManagedSlotMappingConfigurationPersistence(); underTest.registerResolverPersistence(persistenceManager); }