TradeReferenceLine { protected Direction parseDirection( String dir ) { if( "Long".equalsIgnoreCase(dir) ) { return Direction.LONG; } else if( "Short".equalsIgnoreCase(dir) ) { return Direction.SHORT; } else { throw new IllegalStateException( "Unknown Direction: " + dir ); } }  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 testParseDirection() { assertEquals(testLine.parseDirection("Long"), LONG); assertEquals(testLine.parseDirection("Short"), SHORT); try { testLine.parseDirection("foo"); fail(); } catch( IllegalStateException ex ) { } }