### Question:
NavigationService { public synchronized void navigateBack() { if (canNavigateBack()) { pages.remove(pages.size() - 1); fController.setContent(pages.get(pages.size() - 1)); } else { logger.warn("Cannot go back (number of pages: {})", pages.size()); throw new IllegalStateException(String.format( "Cannot navigate back, number of pages: %s", pages.size())); } } @Inject  NavigationService(IFxmlLoaderProvider loader); void setNavigationController(INavigatable controller); INavigatable getNavigationController(); FXMLLoader createLoader(final String fxmlFile); synchronized void navigate(final String fxmlFile); synchronized void navigateBack(); synchronized boolean canNavigateBack(); synchronized void clearPages();  }### Answer:
@Test public void testNavigateBack() { ObservableList<Node> pages = getPages(); assertNotNull(pages); String page_1 = "/testpage1.fxml"; navigationService.navigate(page_1); String page_2 = "/testpage2.fxml"; navigationService.navigate(page_2); String page_3 = "/testpage3.fxml"; navigationService.navigate(page_3); navigationService.navigateBack(); assertTrue(pages.size() == 2); assertEquals(pages.get(0), elements[0]); assertEquals(pages.get(1), elements[1]); navigationService.navigateBack(); assertTrue(pages.size() == 1); assertEquals(pages.get(0), elements[0]); assertFalse(navigationService.canNavigateBack()); }