### Question:
OrderBook { public double getAverageAskAmount(int depth) { return getAverageAmount(asks, 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 testAverageAskAmountDepthBased() { double price; price = book.getAverageAskAmount(1); assertEquals(4.209, price, 0.0001); price = book.getAverageAskAmount(2); assertEquals((4.209 * 149.821 + 4.210 * 277.476) / (149.821 + 277.476), price, 0.0001); }
@Test public void testAverageAskAmountQuantityBased() { double price; price = book.getAverageAskAmount(50.0); assertEquals(4.209, price, 0.0001); price = book.getAverageAskAmount(500.0); assertEquals((4.209 * 149.821 + 4.210 * 277.476 + 4.211 * (500 - (149.821 + 277.476))) / 500.0, price, 0.0001); }