@Test public void testReaderWithUsernameAndPasswordFromSystemPropertiesShouldSuccess() throws StageConfigFileIOException, StageConfigNotFoundException, StageConfigFileInvalidFormatException { String filePath = "src/test/resources/stage_config.json"; System.clearProperty("axway.username"); System.clearProperty("axway.password"); assertTrue(new File(filePath).exists()); String username = "property username"; String password = "property password"; System.setProperty("axway.username", username); System.setProperty("axway.password", password); final Publication publication = new PublicationReader().read(filePath, Publication.class); assertThat(publication.getUsername(), is(username)); assertThat(publication.getPassword(), is(password)); }
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);  }