@Test public void testIndex() throws Exception { Date now = new Date(); DatabaseInfo info = createMock(DatabaseInfo.class); expect(info.getDate()).andReturn(now).anyTimes(); expect(info.isPremium()).andReturn(true).anyTimes(); AutoUpdateScheduler scheduler = createMock(AutoUpdateScheduler.class); GeoIPCity geoIPCity = createMock(GeoIPCity.class); expect(scheduler.getLastModified()).andReturn(100L).anyTimes(); expect(scheduler.getLastCheckpoint()).andReturn(80L).anyTimes(); expect(scheduler.getNextCheckpoint()).andReturn(280L).anyTimes(); expect(scheduler.getDatabase()).andReturn(new File("/")).anyTimes(); expect(scheduler.getGeoIPCity()).andReturn(geoIPCity).anyTimes(); expect(geoIPCity.getDatabaseInfo()).andReturn(info).anyTimes(); replay(info, scheduler, geoIPCity); AboutController subject = new AboutController(geoIPCity, Providers.of(scheduler)); String result = subject.index(); assertEquals(new File("/"), scheduler.getDatabase()); assertEquals(now, info.getDate()); assertEquals(true, info.isPremium()); assertEquals(100L, scheduler.getLastModified()); assertEquals(80L, scheduler.getLastCheckpoint()); assertTrue(result.indexOf("Refresh pending") > 0); }
@Override public void initialize(URL location, ResourceBundle resources) { mbNew.setGraphic(SpeedmentIcon.NEW_PROJECT.view()); mbOpen.setGraphic(SpeedmentIcon.OPEN_PROJECT.view()); mbSave.setGraphic(SilkIcon.DISK.view()); mbSaveAs.setGraphic(SilkIcon.DISK_MULTIPLE.view()); mbQuit.setGraphic(SilkIcon.DOOR_IN.view()); mbGenerate.setGraphic(SpeedmentIcon.RUN_PROJECT.view()); mbGitHub.setGraphic(SilkIcon.USER_COMMENT.view()); mbAbout.setGraphic(SilkIcon.INFORMATION.view()); mbNew.setOnAction(session.newProject()); mbOpen.setOnAction(session.openProject()); mbSave.setOnAction(session.saveProject()); mbSaveAs.setOnAction(session.saveProjectAs()); mbQuit.setOnAction(session.quit()); mbGenerate.setOnAction(session.generate()); mbGitHub.setOnAction(session.showGithub()); mbAbout.setOnAction( ev -> { AboutController.createAndShow(session); }); }