@Test public void testBasicRoundtrip() { resultWriter.addResult(new Result(ResultType.IMAGE, "image", 14, 32)); resultWriter.addResult(new Result(ResultType.GRAPH, "graph.json")); assertThat(new File(OUTPUT_DIR).exists()).isTrue(); assertThat(new File(OUTPUT_DIR).isDirectory()).isTrue(); File resultFile = new File(OUTPUT_DIR, AnalysisResultWriter.QAV_RESULT_FILENAME); assertThat(resultFile.exists()).isTrue(); AnalysisResultReader reader = new AnalysisResultReader(resultFile.getAbsolutePath()); AnalysisResult analysisResult = reader.getAnalysisResult(); assertThat(analysisResult).isNotNull(); assertThat(analysisResult.getItems()).hasSize(2); assertThat(analysisResult).isEqualTo(resultWriter.getAnalysisResult()); assertThat(analysisResult.getAnalysisId()).startsWith("qav-"); assertThat(analysisResult.getAnalysisId()).hasSize(40); assertThat(Duration.between(analysisResult.getAnalysisStart(), LocalDateTime.now()).getSeconds()).isLessThan(5); }
public void addResult(Result result) { LOGGER.debug("Add result: {}", result); this.analysisResult.addResult(result); writeResult(); }
AnalysisResultWriter { public void addResult(Result result) { LOGGER.debug("Add result: {}", result); this.analysisResult.addResult(result); writeResult(); } }
AnalysisResultWriter { public void addResult(Result result) { LOGGER.debug("Add result: {}", result); this.analysisResult.addResult(result); writeResult(); } AnalysisResultWriter(); }
AnalysisResultWriter { public void addResult(Result result) { LOGGER.debug("Add result: {}", result); this.analysisResult.addResult(result); writeResult(); } AnalysisResultWriter(); void setOutputDir(String outputDir); void addResult(Result result); }
AnalysisResultWriter { public void addResult(Result result) { LOGGER.debug("Add result: {}", result); this.analysisResult.addResult(result); writeResult(); } AnalysisResultWriter(); void setOutputDir(String outputDir); void addResult(Result result); static final String QAV_RESULT_FILENAME; }