ResultProcessingDispatcher { public boolean process(String result) { LOG.trace("Checking if partial result is known"); final String checksum = this.getMD5Checksum(result); return !this.doesHashExist(checksum); } ResultProcessingDispatcher(final String cacheFilePath); boolean process(String result);  }
@Test public void shouldTestDispatching() { final ResultProcessingDispatcher dispatcher = new ResultProcessingDispatcher(CACHE_FILE_PATH); final String test = "42"; boolean process = dispatcher.process(test); Assert.assertTrue(process); process = dispatcher.process(test); Assert.assertFalse(process); deleteFile(); }
@Test public void shouldTestFileReading() throws Exception { ResultProcessingDispatcher dispatcher = new ResultProcessingDispatcher(CACHE_FILE_PATH); final String test = "42"; boolean process = dispatcher.process(test); Assert.assertTrue(process); dispatcher = new ResultProcessingDispatcher(CACHE_FILE_PATH); process = dispatcher.process(test); Assert.assertFalse(process); deleteFile(); }