### Question:
OutOfMemoryDetector implements ProblemDetector { @Override public void executeCheck() { try { AtomicReference<State> state = new AtomicReference<>(); state.set(State.LOOKING_FOR_OOM); AtomicReference<String> lastTimeStampLine = new AtomicReference<>(); Files.lines(logContentProvider.getCurrentLogfile(false).toPath()).forEach(line -> { if (line.matches("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.*")) { if (state.get() == State.LOOKING_FOR_OOM) { lastTimeStampLine.set(line); } if (state.get() == State.LOOKING_FOR_OOM_END) { state.set(State.LOOKING_FOR_OOM); } return; } if (line.contains("java.lang.OutOfMemoryError")) { if (state.get() == State.LOOKING_FOR_OOM) { String key = "outOfMemoryDetected-" + lastTimeStampLine.get(); boolean alreadyDetected = genericStorage.get(key, String.class).isPresent(); if (!alreadyDetected) { logger.warn("The log indicates that the process ran out of memory. Please increase the XMX value in the main config and restart."); genericStorage.save(key, true); genericStorage.save("outOfMemoryDetected", true); } state.set(State.LOOKING_FOR_OOM_END); } } }); } catch (IOException e) { logger.warn("Unable to read log file: " + e.getMessage()); } catch (Exception e) { logger.warn("Unable to detect problems in log file", e); } }  @Override void executeCheck();  }### Answer:
@Ignore @Test public void executeCheck() throws Exception { MockitoAnnotations.initMocks(this); final Path tempFile = Files.createTempFile("nzbhydra", ".log"); try { tempFile.toFile().delete(); Files.copy(getClass().getResourceAsStream("logWithOom.log"), tempFile); } catch (Exception e) { return; } when(logContentProviderMock.getCurrentLogfile(false)).thenReturn(tempFile.toFile()); testee.executeCheck(); verify(genericStorageMock, times(4)).save(stringArgumentCaptor.capture(), objectArgumentCaptor.capture()); assertThat(stringArgumentCaptor.getAllValues().get(0)).isEqualTo("outOfMemoryDetected-2018-11-09 00:17:46 database: close"); assertThat(stringArgumentCaptor.getAllValues().get(1)).isEqualTo("outOfMemoryDetected"); assertThat(stringArgumentCaptor.getAllValues().get(2)).isEqualTo("outOfMemoryDetected-2018-11-09 11:11:46 database: close"); assertThat(stringArgumentCaptor.getAllValues().get(3)).isEqualTo("outOfMemoryDetected"); assertThat(objectArgumentCaptor.getAllValues().get(0)).isEqualTo(true); assertThat(objectArgumentCaptor.getAllValues().get(1)).isEqualTo(true); }