### Question:
OrderBook { public double getAverageBidAmount(int depth) { return getAverageAmount(bids, depth); } OrderBook(ClientAccount account, String symbol, int depth); void addBid(double price, double quantity); void addAsk(double price, double quantity); double getAverageAskAmount(int depth); double getAverageBidAmount(int depth); double getSpread(int depth); double getAverageAskAmount(double quantityToFill); double getAverageBidAmount(double quantityToFill); double getSpread(double quantityToFill); String getSymbol(); int getDepth(); Map<Double, Double> getBids(); Map<Double, Double> getAsks(); OrderBook update(int depth); @Override String toString(); boolean isEmpty();  }### Answer:
@Test public void testAverageBidAmountQuantityBased() { double price; price = book.getAverageBidAmount(50.0); assertEquals(4.203, price, 0.0001); price = book.getAverageBidAmount(2000.0); assertEquals((0 + 4.203 * 357.676 + 4.202 * 1204.564 + 4.201 * 150.415 + 4.199 * (2000 - (357.676 + 1204.564 + 150.415)) ) / 2000.0, price, 0.0001); }
@Test public void testAverageBidAmountDepthBased() { double price; price = book.getAverageBidAmount(1); assertEquals(4.203, price, 0.0001); price = book.getAverageBidAmount(2); assertEquals((4.203 * 357.676 + 4.202 * 1204.564) / (357.676 + 1204.564), price, 0.0001); }