### Question:
TradeServiceImpl implements TradeService { @Override public Stream<Trade> getBidOrderTrades(long bidOrderId, int from, int to) { return converter.convert( tradeTable.getManyBy( new DbClause.LongClause("bid_order_id", bidOrderId), from, to ) ); } TradeServiceImpl(
        final DatabaseManager databaseManager,
        final Blockchain blockchain,
        final TradeTable tradeTable,
        final IteratorToStreamConverter<Trade> converter
    ); @Inject  TradeServiceImpl(
        final DatabaseManager databaseManager,
        final Blockchain blockchain,
        final TradeTable tradeTable
    ); @Override Stream<Trade> getAllTrades(int from, int to); @Override int getCount(); @Override Trade getTrade(long askOrderId, long bidOrderId); @Override Stream<Trade> getAssetTrades(long assetId, int from, int to); @Override List<Trade> getLastTrades(long[] assetIds); @Override Stream<Trade> getAccountTrades(long accountId, int from, int to); @Override Stream<Trade> getAccountAssetTrades(long accountId, long assetId, int from, int to); @Override Stream<Trade> getAskOrderTrades(long askOrderId, int from, int to); @Override Stream<Trade> getBidOrderTrades(long bidOrderId, int from, int to); @Override int getTradeCount(long assetId); @Override Trade addTrade(long assetId, AskOrder askOrder, BidOrder bidOrder);  }### Answer:
@Test void shouldGetBidOrderTrades() { final long bidOrderId = 500L; final int from = 0; final int to = 100; @SuppressWarnings("unchecked") final DbIterator<Trade> dbIterator = mock(DbIterator.class); final Trade trade = mock(Trade.class); when(tradeTable.getManyBy(any(DbClause.LongClause.class), eq(from), eq(to))) .thenReturn(dbIterator); final Stream<Trade> tradesExpected = Stream.of(trade); when(converter.convert(dbIterator)).thenReturn(tradesExpected); final Stream<Trade> tradesActual = tradeService.getBidOrderTrades(bidOrderId, from, to); assertEquals(tradesExpected, tradesActual); }