EODSystemProperties { protected void parseProps( Properties props ) { twsHost = props.getProperty("tws.host"); twsPort = Integer.parseInt(props.getProperty("tws.port")); twsClientId = Integer.parseInt(props.getProperty("tws.client.id")); tradeSizeDollars = Integer.parseInt(props.getProperty("trade.size.dollars")); startTime = LocalTime.parse(props.getProperty("start.time")); exitTime = LocalTime.parse(props.getProperty("exit.time")); marketCloseTime = LocalTime.parse(props.getProperty("market.close.time")); strategyDirectory = props.getProperty("strategy.directory"); entryOrderType = getOrderType(props.getProperty("entry.order.type", "MOC")); longShortTickerMap = getLongShortTickers(props); exitOrderType = getOrderType(props.getProperty("exit.order.type", "MOO")); exitSeconds = Integer.parseInt(props.getProperty("exit.seconds", "0")); } protected  EODSystemProperties();  EODSystemProperties(String fileName);  EODSystemProperties(InputStream inputStream); LocalTime getStartTime(); String getTwsHost(); int getTwsPort(); int getTwsClientId(); int getTradeSizeDollars(); Map<String, String> getLongShortTickerMap(); LocalTime getMarketCloseTime(); String getStrategyDirectory(); TradeOrder.Type getEntryOrderType(); Type getExitOrderType(); int getExitSeconds(); LocalTime getExitTime(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testParseProps() { Map<String,String> expectedMap = new HashMap<>(); expectedMap.put("QQQ", "SPY"); expectedMap.put("IWM", "DIA"); Properties props = new Properties(); props.setProperty("tws.host", "myHost"); props.setProperty("tws.port", "123"); props.setProperty("tws.client.id", "13"); props.setProperty("trade.size.dollars", "999"); props.setProperty("start.time", "05:32:44"); props.setProperty("exit.time", "06:30:02"); props.setProperty("market.close.time", "13:00:00"); props.setProperty("pair.1", "QQQ:SPY"); props.setProperty("foo", "bar"); props.setProperty("pair.2", "IWM:DIA"); props.setProperty("strategy.directory", "/my/dir"); props.setProperty("entry.order.type", "MOC"); props.setProperty("exit.order.type", "MOO"); props.setProperty("exit.seconds", "10"); systemProps.parseProps(props); assertEquals("myHost", systemProps.getTwsHost()); assertEquals(123, systemProps.getTwsPort()); assertEquals(13, systemProps.getTwsClientId()); assertEquals(999, systemProps.getTradeSizeDollars()); assertEquals("/my/dir", systemProps.getStrategyDirectory()); assertEquals(LocalTime.of(5, 32, 44), systemProps.getStartTime()); assertEquals(LocalTime.of(6, 30, 02), systemProps.getExitTime()); assertEquals(LocalTime.of(13,0), systemProps.getMarketCloseTime()); assertEquals(TradeOrder.Type.MARKET_ON_CLOSE, systemProps.getEntryOrderType()); assertEquals(expectedMap, systemProps.getLongShortTickerMap()); assertEquals(TradeOrder.Type.MARKET_ON_OPEN, systemProps.getExitOrderType()); assertEquals( 10, systemProps.getExitSeconds() ); }