### Question:
OrderBook { public double getSpread(int depth) { double ask = getAverageAskAmount(depth); double bid = getAverageBidAmount(depth); return ask - bid; } 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 testSpreadAmountQuantityBased() { double spread; spread = book.getSpread(50.0); assertEquals(0.006, spread, 0.0001); spread = book.getSpread(2000.0); assertEquals(0.011730481500000778, spread, 0.0001); }
@Test public void testSpreadAmountDepthBased() { double spread; spread = book.getSpread(1); assertEquals(0.006, spread, 0.0001); spread = book.getSpread(2); assertEquals( 4.209649375024865 - 4.202228950737403, spread, 0.0001); }