@Test public void shouldClearAllNavigationHistory() throws Exception { ForwardListener forwardListener = prepareLocationHistory(); reset(forwardListener); navigationManager.navigate(this).to(locId5, new Forwarder().clearAll()); ArgumentCaptor<NavigationManager.Event.OnLocationForward> event = ArgumentCaptor.forClass(NavigationManager.Event.OnLocationForward.class); verify(forwardListener).onEvent(event.capture()); assertEquals(event.getValue().getLastValue().getLocationId(), locId4.getName()); assertEquals(event.getValue().getCurrentValue().getLocationId(), locId5.getName()); assertEquals(event.getValue().getLocationWhereHistoryClearedUpTo(), null); assertEquals(event.getValue().isClearHistory(), true); //Now the history should be loc1->loc2->loc5 NavLocation currentLoc = navigationManager.getModel().getCurrentLocation(); assertEquals(currentLoc.getLocationId(), locId5.getName()); assertEquals(currentLoc.getPreviousLocation(), null); }
assertEquals(event.getValue().getCurrentValue().getLocationId(), locId1.getName()); assertEquals(event.getValue().getLocationWhereHistoryClearedUpTo(), null); assertEquals(event.getValue().isClearHistory(), false); assertEquals(event.getValue().getCurrentValue().getLocationId(), locId2.getName()); assertEquals(event.getValue().getLocationWhereHistoryClearedUpTo(), null); assertEquals(event.getValue().isClearHistory(), false); assertEquals(event.getValue().getCurrentValue().getLocationId(), locId3.getName()); assertEquals(event.getValue().getLocationWhereHistoryClearedUpTo(), null); assertEquals(event.getValue().isClearHistory(), false); assertEquals(event.getValue().getCurrentValue().getLocationId(), locId4.getName()); assertEquals(event.getValue().getLocationWhereHistoryClearedUpTo(), null); assertEquals(event.getValue().isClearHistory(), false);
assertEquals(event.getValue().getLastValue().getLocationId(), locId1.getName()); assertEquals(event.getValue().getCurrentValue().getLocationId(), locId5.getName()); assertEquals(event.getValue().getLocationWhereHistoryClearedUpTo().getLocationId(), locId3.getName()); assertEquals(event.getValue().isClearHistory(), true);