Level1Quote extends AbstractQuote implements ILevel1Quote { public Level1Quote(Ticker ticker, ZonedDateTime timestamp, Map<QuoteType, BigDecimal> quoteValues) { super(ticker, timestamp); this.quoteMap = quoteValues; } Level1Quote(Ticker ticker, ZonedDateTime timestamp, Map<QuoteType, BigDecimal> quoteValues); @Override QuoteType[] getTypes(); @Override boolean containsType(QuoteType type); @Override BigDecimal getValue(QuoteType type); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testLevel1Quote() { QuoteType[] types = {QuoteType.ASK, QuoteType.BID}; BigDecimal bid = new BigDecimal( 2.5 ); BigDecimal ask = new BigDecimal(3.5); StockTicker ticker = new StockTicker("ABC"); Map<QuoteType,BigDecimal> map = new HashMap<>(); map.put(QuoteType.BID, bid); map.put(QuoteType.ASK, ask); ZonedDateTime now = ZonedDateTime.now(); Level1Quote quote= new Level1Quote(ticker, now, map); List<QuoteType> returnedTypes = Arrays.asList(quote.getTypes()); assertEquals(2, returnedTypes.size()); assertTrue(returnedTypes.contains(QuoteType.BID)); assertTrue(returnedTypes.contains(QuoteType.ASK)); assertTrue(quote.containsType(QuoteType.BID)); assertTrue(quote.containsType(QuoteType.ASK)); assertFalse(quote.containsType(QuoteType.OPEN)); assertEquals( bid, quote.getValue(QuoteType.BID)); try { quote.getValue(QuoteType.OPEN); fail(); } catch( SumZeroException ex ) { } }