Open cushon opened 10 years ago
Original issue created by fmcwilliams@google.com on 2013-04-02 at 08:30 PM
Bug pattern: assertEquals() calls that are technically legal but produce misleading error messages.
Good patterns:
assertEquals("constant", myVar); assertEquals(123, myInt);
checkMoney(myMoney, 12500000L, "USD"); ... private void checkMoney(Money money, long expectedMicros, String expectedCurr) { assertEquals(expectedMicros, money.getMicros()); assertEquals(expectedCurr, money.getCurrencyCode()); }
Bad patterns:
assertEquals(myVar, "constant"); assertEquals(myInt, 123);
checkMoney(myMoney, 12500000L, "USD"); ... private void checkMoney(Money money, long expectedMicros, String expectedCurr) { assertEquals(money.getMicros(), expectedMicros); assertEquals(money.getCurrencyCode(), expectedCurr); }
Original issue created by fmcwilliams@google.com on 2013-04-02 at 08:30 PM
Bug pattern: assertEquals() calls that are technically legal but produce misleading error messages.
Good patterns:
assertEquals("constant", myVar); assertEquals(123, myInt);
checkMoney(myMoney, 12500000L, "USD"); ... private void checkMoney(Money money, long expectedMicros, String expectedCurr) { assertEquals(expectedMicros, money.getMicros()); assertEquals(expectedCurr, money.getCurrencyCode()); }
Bad patterns:
assertEquals(myVar, "constant"); assertEquals(myInt, 123);
checkMoney(myMoney, 12500000L, "USD"); ... private void checkMoney(Money money, long expectedMicros, String expectedCurr) { assertEquals(money.getMicros(), expectedMicros); assertEquals(money.getCurrencyCode(), expectedCurr); }