@Test(expected = StageConfigNotFoundException.class) public void testPublicationReaderWithNonExistingFileShouldThrowException() throws StageConfigFileIOException, StageConfigNotFoundException, StageConfigFileInvalidFormatException { final String filePath = "not_exists.json"; assertFalse(new File(filePath).exists()); new PublicationReader().read(filePath, Publication.class); }
public <T> T read(String f, Class<T> classOfT) throws StageConfigNotFoundException, StageConfigFileInvalidFormatException, StageConfigFileIOException { try { final Reader reader = new FileReader(f); return read(reader, classOfT); } catch (JsonIOException e) { throw new StageConfigFileIOException(e.getMessage(), e); } catch (FileNotFoundException e) { throw new StageConfigNotFoundException(e.getMessage(), e); } catch (JsonSyntaxException e) { throw new StageConfigFileInvalidFormatException(e.getMessage(), e); } }
PublicationReader { public <T> T read(String f, Class<T> classOfT) throws StageConfigNotFoundException, StageConfigFileInvalidFormatException, StageConfigFileIOException { try { final Reader reader = new FileReader(f); return read(reader, classOfT); } catch (JsonIOException e) { throw new StageConfigFileIOException(e.getMessage(), e); } catch (FileNotFoundException e) { throw new StageConfigNotFoundException(e.getMessage(), e); } catch (JsonSyntaxException e) { throw new StageConfigFileInvalidFormatException(e.getMessage(), e); } } }
PublicationReader { public <T> T read(String f, Class<T> classOfT) throws StageConfigNotFoundException, StageConfigFileInvalidFormatException, StageConfigFileIOException { try { final Reader reader = new FileReader(f); return read(reader, classOfT); } catch (JsonIOException e) { throw new StageConfigFileIOException(e.getMessage(), e); } catch (FileNotFoundException e) { throw new StageConfigNotFoundException(e.getMessage(), e); } catch (JsonSyntaxException e) { throw new StageConfigFileInvalidFormatException(e.getMessage(), e); } }  }
PublicationReader { public <T> T read(String f, Class<T> classOfT) throws StageConfigNotFoundException, StageConfigFileInvalidFormatException, StageConfigFileIOException { try { final Reader reader = new FileReader(f); return read(reader, classOfT); } catch (JsonIOException e) { throw new StageConfigFileIOException(e.getMessage(), e); } catch (FileNotFoundException e) { throw new StageConfigNotFoundException(e.getMessage(), e); } catch (JsonSyntaxException e) { throw new StageConfigFileInvalidFormatException(e.getMessage(), e); } }  T read(String f, Class<T> classOfT); T read(Reader r, Class<T> classOfT); }
PublicationReader { public <T> T read(String f, Class<T> classOfT) throws StageConfigNotFoundException, StageConfigFileInvalidFormatException, StageConfigFileIOException { try { final Reader reader = new FileReader(f); return read(reader, classOfT); } catch (JsonIOException e) { throw new StageConfigFileIOException(e.getMessage(), e); } catch (FileNotFoundException e) { throw new StageConfigNotFoundException(e.getMessage(), e); } catch (JsonSyntaxException e) { throw new StageConfigFileInvalidFormatException(e.getMessage(), e); } }  T read(String f, Class<T> classOfT); T read(Reader r, Class<T> classOfT);  }