@Test
public void return_default_value_if_can_not_read_file() throws Exception {

  Settings settings = mock(Settings.class);
  when(settings.getString("sonar.junit.reportsPath")).thenReturn("target/surefire");
  PathResolver pathResolver = mock(PathResolver.class);
  when(pathResolver.relativeFile(any(File.class), anyString())).thenThrow(new IllegalStateException());
  File directory = SurefireUtils.getReportsDirectory(settings, fs, pathResolver);
  assertThat(directory.getCanonicalPath()).endsWith("target" + File.separator + "surefire-reports");
  assertThat(directory.exists()).isFalse();
  assertThat(directory.isDirectory()).isFalse();
}