BitmexProperties { public void readProperties(Properties properties) { useProduction = Boolean.parseBoolean(properties.getProperty(BitmexPropKey.USE_PRODUCTION)); apiKeyName = properties.getProperty(BitmexPropKey.API_KEY_NAME, ""); apiKeyValue = properties.getProperty(BitmexPropKey.API_KEY_VALUE, ""); }  String getApiKeyName(); void setApiKeyName(String apiKeyName); String getApiKeyValue(); void setApiKeyValue(String apiKeyValue); boolean isUseProduction(); void setUseProduction(boolean useProduction); void readProperties(Properties properties); void readProperties(String filename); void readProperties(InputStream input);  }
@Test public void testReadProperties_Properties() { Properties props = new Properties(); props.setProperty(BitmexPropKey.USE_PRODUCTION, "true"); props.setProperty(BitmexPropKey.API_KEY_NAME, "myApiKeyName"); props.setProperty(BitmexPropKey.API_KEY_VALUE, "myApiKeyValue"); BitmexProperties bitmexProps = new BitmexProperties(); bitmexProps.readProperties(props); assertValues(bitmexProps); }
@Test public void testReadProperties_InputStream() { BitmexProperties props = new BitmexProperties(); props.readProperties(getClass().getResourceAsStream("/testprops.properties")); assertValues(props); }
@Test public void testReadProperties_File() throws Exception { BitmexProperties props = new BitmexProperties(); props.readProperties(getClass().getResource("/testprops.properties").toURI().getPath()); assertValues(props); }