StatusSetter { public static void setStatus(Execution execution, ExecutionStatus status) { Date now = new Date(); execution.setStatus(status); execution.setLastChange(now); updateOverview(execution); updateOverviewStatements(execution); }  static void setStatus(Execution execution, ExecutionStatus status); static void updateOverview(Execution execution);  }
@Test public void updateState() { Execution execution = new Execution(); execution.setIri("http: OverviewFactory overviewFactory = new OverviewFactory(); JsonNode overview = overviewFactory.createQueued(execution); execution.setOverviewJson(overview); Date beforeDate = new Date(); StatusSetter.setStatus(execution, ExecutionStatus.RUNNING); Date afterDate = new Date(); Assert.assertEquals(ExecutionStatus.RUNNING, execution.getStatus()); Assert.assertFalse(beforeDate.after(execution.getLastChange())); Assert.assertFalse(afterDate.before(execution.getLastChange())); Statements expected = Statements.arrayList(); expected.setDefaultGraph(execution.getListGraph()); expected.addIri(execution.getIri(), LP_OVERVIEW.HAS_STATUS, ExecutionStatus.RUNNING.asStr()); Statements actual = new Statements(execution.getOverviewStatements()); Assert.assertTrue(actual.containsAllLogMissing(expected)); }