@Test public void testEquality() { ZeroCostModel model = new ZeroCostModel(); CostModel modelSame = new ZeroCostModel(); CostModel modelOther = new LinearTransactionCostModel(0.1); boolean equality = model.equals(modelSame); boolean inequality = model.equals(modelOther); assertTrue(equality); assertFalse(inequality); }
public boolean equals(CostModel otherModel) { boolean equality = false; if (this.getClass().equals(otherModel.getClass())) { equality = true; } return equality; }
ZeroCostModel implements CostModel { public boolean equals(CostModel otherModel) { boolean equality = false; if (this.getClass().equals(otherModel.getClass())) { equality = true; } return equality; } }
ZeroCostModel implements CostModel { public boolean equals(CostModel otherModel) { boolean equality = false; if (this.getClass().equals(otherModel.getClass())) { equality = true; } return equality; } ZeroCostModel(); }
ZeroCostModel implements CostModel { public boolean equals(CostModel otherModel) { boolean equality = false; if (this.getClass().equals(otherModel.getClass())) { equality = true; } return equality; } ZeroCostModel(); Num calculate(Trade trade); Num calculate(Trade trade, int currentIndex); Num calculate(Num price, Num amount); boolean equals(CostModel otherModel); }
ZeroCostModel implements CostModel { public boolean equals(CostModel otherModel) { boolean equality = false; if (this.getClass().equals(otherModel.getClass())) { equality = true; } return equality; } ZeroCostModel(); Num calculate(Trade trade); Num calculate(Trade trade, int currentIndex); Num calculate(Num price, Num amount); boolean equals(CostModel otherModel);  }