### Question:
LinearBorrowingCostModel implements CostModel { public boolean equals(CostModel otherModel) { boolean equality = false; if (this.getClass().equals(otherModel.getClass())) { equality = ((LinearBorrowingCostModel) otherModel).feePerPeriod == this.feePerPeriod; } return equality; } LinearBorrowingCostModel(double feePerPeriod); Num calculate(Num price, Num amount); Num calculate(Trade trade); Num calculate(Trade trade, int currentIndex); boolean equals(CostModel otherModel);  }### Answer:
@Test public void testEquality() { LinearBorrowingCostModel model = new LinearBorrowingCostModel(0.1); CostModel modelSameClass = new LinearBorrowingCostModel(0.2); CostModel modelSameFee = new LinearBorrowingCostModel(0.1); CostModel modelOther = new ZeroCostModel(); boolean equality = model.equals(modelSameFee); boolean inequality1 = model.equals(modelSameClass); boolean inequality2 = model.equals(modelOther); assertTrue(equality); assertFalse(inequality1); assertFalse(inequality2); }