@Test /** Tests the bill getters. */ public void getters() { assertEquals("Bill transation: getter", BILL_PURCHASE, BILL_TRA.getBillPurchased()); assertEquals("Bill transation: getter", QUANTITY, BILL_TRA.getQuantity()); assertEquals("Bill transation: getter", SETTLE_AMOUT, BILL_TRA.getSettlementAmount()); assertEquals("Bill transation: getter", BILL_STANDARD, BILL_TRA.getBillStandard()); }
@Test /** Tests the equal and hash-code methods. */ public void equalHash() { assertEquals("Bill transaction: equal-hash code", BILL_TRA, BILL_TRA); BillTransaction other = new BillTransaction(BILL_PURCHASE, QUANTITY, SETTLE_AMOUT, BILL_STANDARD); assertEquals("Bill transaction: equal-hash code", BILL_TRA, other); assertEquals("Bill transaction: equal-hash code", BILL_TRA.hashCode(), other.hashCode()); BillTransaction modified; modified = new BillTransaction(BILL_STANDARD, QUANTITY, SETTLE_AMOUT, BILL_STANDARD); assertFalse("Bill transaction: equal-hash code", BILL_TRA.equals(modified)); modified = new BillTransaction(BILL_PURCHASE, QUANTITY + 1.0, SETTLE_AMOUT, BILL_STANDARD); assertFalse("Bill transaction: equal-hash code", BILL_TRA.equals(modified)); modified = new BillTransaction(BILL_PURCHASE, QUANTITY, SETTLE_AMOUT + 1.0, BILL_STANDARD); assertFalse("Bill transaction: equal-hash code", BILL_TRA.equals(modified)); modified = new BillTransaction(BILL_PURCHASE, QUANTITY, SETTLE_AMOUT, BILL_PURCHASE); assertFalse("Bill transaction: equal-hash code", BILL_TRA.equals(modified)); }