HistoryUtil { public void storeExecutionInHistory(HistoryEntry history, ExecutionResult result, ResourceResolver resolver) throws AecuException { String path = history.getRepositoryPath() + "/" + history.getSingleResults().size(); saveExecutionResultInHistory(result, path, resolver); }  HistoryEntry createHistoryEntry(ResourceResolver resolver); void storeExecutionInHistory(HistoryEntry history, ExecutionResult result, ResourceResolver resolver); void finishHistoryEntry(HistoryEntry history, ResourceResolver resolver); List<HistoryEntry> getHistory(int startIndex, int count, ResourceResolver resolver); Resource getHistoryEntryResource(Resource child); HistoryEntry readHistoryEntry(Resource resource); ExecutionResult readHistorySingleResult(Resource resource); void purgeHistory(ResourceResolver resolver, int daysToKeep); void selfCheck(ResourceResolver resolver); static final String HISTORY_BASE; static final String NODE_FALLBACK; static final String ATTR_PATH; }
@Test public void storeExecutionInHistory() throws AecuException { when(resolver.getResource(Mockito.anyString())).thenReturn(resource); HistoryEntry history = mock(HistoryEntry.class); ExecutionResult result = mock(ExecutionResult.class); when(result.getState()).thenReturn(ExecutionState.SUCCESS); when(result.getOutput()).thenReturn("out"); when(result.getResult()).thenReturn("result"); when(result.getTime()).thenReturn("time"); historyUtil.storeExecutionInHistory(history, result, resolver); verify(valueMap, times(1)).put("runState", ExecutionState.SUCCESS.name()); }