TradeReferenceLine { public void parse( String referenceLine ) { String[] mainTokens = referenceLine.split("\\*"); String[] tokens = mainTokens[0].split(":"); strategy = tokens[0]; correlationId = tokens[1]; side = parseSide(tokens[2]); direction = parseDirection(tokens[3]); }  void parse( String referenceLine ); String getStrategy(); String getCorrelationId(); Direction getDirection(); Side getSide(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static long serialVersionUID; }
@Test public void testParse() { String e = "Intraday-Strategy:123:Exit:Long*"; TradeReferenceLine expected = new TradeReferenceLine(); expected.correlationId = "123"; expected.strategy = "Intraday-Strategy"; expected.side = EXIT; expected.direction = LONG; doReturn(LONG).when(testLine).parseDirection("Long"); doReturn(EXIT).when(testLine).parseSide("Exit"); testLine.parse(e); assertEquals(expected.toString(),testLine.toString()); }
@Test public void testParse() { String e = "EOD-Pair-Strategy:123:Exit:Long*"; TradeReferenceLine expected = new TradeReferenceLine(); expected.correlationId = "123"; expected.strategy = "EOD-Pair-Strategy"; expected.side = EXIT; expected.direction = LONG; doReturn(LONG).when(testLine).parseDirection("Long"); doReturn(EXIT).when(testLine).parseSide("Exit"); testLine.parse(e); assertEquals(expected.toString(),testLine.toString()); }