@Test public void nonExistentFile() throws Exception { File file = mock(File.class); when(file.exists()).thenReturn(false); assertThatThrownBy(() -> loader.load(file)).isInstanceOf(FileNotFoundException.class); }
@Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(file.getAbsolutePath())); } catch (Exception e) { throw new FileNotFoundException(e.getMessage()); } }
DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(file.getAbsolutePath())); } catch (Exception e) { throw new FileNotFoundException(e.getMessage()); } } }
DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(file.getAbsolutePath())); } catch (Exception e) { throw new FileNotFoundException(e.getMessage()); } }  }
DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(file.getAbsolutePath())); } catch (Exception e) { throw new FileNotFoundException(e.getMessage()); } }  @Override @SuppressWarnings("IllegalCatch") Configuration load(File file); @Override Configuration load(InputStream input); }
DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(file.getAbsolutePath())); } catch (Exception e) { throw new FileNotFoundException(e.getMessage()); } }  @Override @SuppressWarnings("IllegalCatch") Configuration load(File file); @Override Configuration load(InputStream input);  }