BitmexLevel1QuoteEngine extends QuoteEngine implements IQuoteListener, ITradeListener { @Override public void tradeUpdated(BitmexTrade trade) { Ticker ticker = tickerMap.get(trade.getSymbol()); Map<QuoteType, BigDecimal> quoteMap = new HashMap<>(); quoteMap.put(QuoteType.LAST, new BigDecimal(trade.getPrice())); quoteMap.put(QuoteType.LAST_SIZE, new BigDecimal(trade.getSize())); ZonedDateTime timestamp = getTimestamp(trade.getTimestamp()); Level1Quote quote = new Level1Quote(ticker, timestamp, quoteMap); fireLevel1Quote(quote); }  @Override void startEngine(); @Override void startEngine(Properties props); @Override void stopEngine(); @Override Date getServerTime(); @Override boolean started(); @Override boolean isConnected(); @Override void useDelayedData(boolean useDelayed); @Override void subscribeLevel1(Ticker ticker, Level1QuoteListener listener); @Override void quoteUpdated(BitmexQuote quoteData); @Override void tradeUpdated(BitmexTrade trade); int getMessageProcessorQueueSize();  }
@Test public void testTradeUpdate() { Ticker ticker = new GenericTicker("ABC"); testQuoteEngine.tickerMap.put("ABC", ticker); String timestampString = "2018-07-24T16:45:32.739Z"; ZonedDateTime timestamp = ZonedDateTime.of(2018, 7, 24, 16, 45, 32, 739, ZoneId.of("GMT")); doNothing().when(testQuoteEngine).fireLevel1Quote(any(Level1Quote.class)); double last = 123.44; double lastSize = 4433; BigDecimal expectedLast = new BigDecimal(last); BigDecimal expectedLastSize = new BigDecimal(lastSize); Map<QuoteType,BigDecimal> quoteMap = new HashMap<>(); quoteMap.put(QuoteType.LAST, expectedLast); quoteMap.put(QuoteType.LAST_SIZE, expectedLastSize); Level1Quote expectedQuote = new Level1Quote(ticker, timestamp, quoteMap); BitmexTrade trade = new BitmexTrade(); trade.setPrice(last); trade.setSize(lastSize); trade.setSymbol("ABC"); trade.setSide("Buy"); trade.setTimestamp(timestampString); testQuoteEngine.tradeUpdated(trade); verify( testQuoteEngine, times(1)).fireLevel1Quote(expectedQuote); System.out.println("Quote is: " + expectedQuote ); }