@Test public void equals_shouldCompareDrugOrderExactly() { Assert.assertTrue(regimen1.equals(regimen2)); Assert.assertTrue(regimen2.equals(regimen1)); Assert.assertFalse(regimen1.equals(regimen3)); Assert.assertFalse(regimen3.equals(regimen1)); Assert.assertFalse(regimen1.equals(regimen4)); Assert.assertFalse(regimen4.equals(regimen1)); Assert.assertFalse(regimen1.equals(null)); }
@Override public boolean equals(Object o) { if (!(o instanceof RegimenOrder)) { return false; } RegimenOrder order = (RegimenOrder) o; return drugOrders.equals(order.getDrugOrders()); }
RegimenOrder { @Override public boolean equals(Object o) { if (!(o instanceof RegimenOrder)) { return false; } RegimenOrder order = (RegimenOrder) o; return drugOrders.equals(order.getDrugOrders()); } }
RegimenOrder { @Override public boolean equals(Object o) { if (!(o instanceof RegimenOrder)) { return false; } RegimenOrder order = (RegimenOrder) o; return drugOrders.equals(order.getDrugOrders()); } RegimenOrder(Set<DrugOrder> drugOrders); }
RegimenOrder { @Override public boolean equals(Object o) { if (!(o instanceof RegimenOrder)) { return false; } RegimenOrder order = (RegimenOrder) o; return drugOrders.equals(order.getDrugOrders()); } RegimenOrder(Set<DrugOrder> drugOrders); Set<DrugOrder> getDrugOrders(); List<DrugOrder> getDrugOrders(DrugReference drugRef); List<DrugReference> getDrugReferences(); boolean hasSameDrugs(RegimenOrder order); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
RegimenOrder { @Override public boolean equals(Object o) { if (!(o instanceof RegimenOrder)) { return false; } RegimenOrder order = (RegimenOrder) o; return drugOrders.equals(order.getDrugOrders()); } RegimenOrder(Set<DrugOrder> drugOrders); Set<DrugOrder> getDrugOrders(); List<DrugOrder> getDrugOrders(DrugReference drugRef); List<DrugReference> getDrugReferences(); boolean hasSameDrugs(RegimenOrder order); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }