TradeReferenceLine { protected Side parseSide( String side ) { if( "Exit".equalsIgnoreCase(side)) { return Side.EXIT; } else if( "Entry".equalsIgnoreCase(side)) { return Side.ENTRY; } else { throw new IllegalStateException( "Unknown Side: " + side ); } }  static TradeReferenceLine create( String strategy, Direction direction, Side side ); static TradeReferenceLine createEntryLine( String strategy, Direction direction ); static TradeReferenceLine createExitLine( String strategy, Direction direction, String correlationId); static TradeReferenceLine createEntryLine( String strategy, Direction direction, String additionalInfo ); static TradeReferenceLine create( String strategy, Direction direction, Side side, String additionalInfo ); static TradeReferenceLine parseLine( String referenceLine ); void parse( String referenceLine ); String getStrategy(); TradeReferenceLine setStrategy(String strategy); String getCorrelationId(); TradeReferenceLine setCorrelationId(String correlationId); Direction getDirection(); TradeReferenceLine setDirection(Direction direction); Side getSide(); TradeReferenceLine setSide(Side side); String getAdditionalInfo(); void setAdditionalInfo(String additionalInfo); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static final long serialVersionUID; }
@Test public void testParseSide() { assertEquals(testLine.parseSide("Entry"), ENTRY); assertEquals(testLine.parseSide("Exit"), EXIT); try { testLine.parseSide("foo"); } catch( IllegalStateException ex ) { } }