### Question:
NavigationService { public synchronized void navigate(final String fxmlFile) { if (fController == null) { throw new IllegalStateException("Controller must not be null, please set an instance."); } Node content = null; try { FXMLLoader loader = createLoader(fxmlFile); content = loader.load(); fController.setContent(content); pages.add(content); } catch (IOException e) { logger.warn("Could not load fxml file ({}).", e.getMessage(), e); } } @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 testNavigate() throws IOException { ObservableList<Node> pages = getPages(); assertNotNull(pages); String page_1 = "/testpage1.fxml"; navigationService.navigate(page_1); Mockito.verify(fxmlLoaderProvider, Mockito.times(1)).create(page_1); Mockito.verify(fxmlLoader, Mockito.times(1)).load(); Mockito.verify(controller, Mockito.times(1)).setContent(elements[0]); assertTrue(pages.size() == 1); assertEquals(pages.get(0), elements[0]); String page_2 = "/testpage2.fxml"; navigationService.navigate(page_2); Mockito.verify(fxmlLoaderProvider, Mockito.times(1)).create(page_2); Mockito.verify(fxmlLoader, Mockito.times(2)).load(); Mockito.verify(controller, Mockito.times(1)).setContent(elements[1]); assertTrue(pages.size() == 2); assertEquals(pages.get(0), elements[0]); assertEquals(pages.get(1), elements[1]); String page_3 = "/testpage3.fxml"; navigationService.navigate(page_3); Mockito.verify(fxmlLoaderProvider, Mockito.times(1)).create(page_3); Mockito.verify(fxmlLoader, Mockito.times(3)).load(); Mockito.verify(controller, Mockito.times(1)).setContent(elements[2]); assertTrue(pages.size() == 3); assertEquals(pages.get(0), elements[0]); assertEquals(pages.get(1), elements[1]); assertEquals(pages.get(2), elements[2]); }