public void testMinus_int() { Minutes test2 = Minutes.minutes(2); Minutes result = test2.minus(3); assertEquals(2, test2.getMinutes()); assertEquals(-1, result.getMinutes()); assertEquals(1, Minutes.ONE.minus(0).getMinutes()); try { Minutes.MIN_VALUE.minus(1); fail(); } catch (ArithmeticException ex) { // expected } }
public void testMinus_Minutes() { Minutes test2 = Minutes.minutes(2); Minutes test3 = Minutes.minutes(3); Minutes result = test2.minus(test3); assertEquals(2, test2.getMinutes()); assertEquals(3, test3.getMinutes()); assertEquals(-1, result.getMinutes()); assertEquals(1, Minutes.ONE.minus(Minutes.ZERO).getMinutes()); assertEquals(1, Minutes.ONE.minus((Minutes) null).getMinutes()); try { Minutes.MIN_VALUE.minus(Minutes.ONE); fail(); } catch (ArithmeticException ex) { // expected } }
public void testNegated() { Minutes test = Minutes.minutes(12); assertEquals(-12, test.negated().getMinutes()); assertEquals(12, test.getMinutes()); try { Minutes.MIN_VALUE.negated(); fail(); } catch (ArithmeticException ex) { // expected } }
public void testMultipliedBy_int() { Minutes test = Minutes.minutes(2); assertEquals(6, test.multipliedBy(3).getMinutes()); assertEquals(2, test.getMinutes()); assertEquals(-6, test.multipliedBy(-3).getMinutes()); assertSame(test, test.multipliedBy(1)); Minutes halfMax = Minutes.minutes(Integer.MAX_VALUE / 2 + 1); try { halfMax.multipliedBy(2); fail(); } catch (ArithmeticException ex) { // expected } }
public void testDividedBy_int() { Minutes test = Minutes.minutes(12); assertEquals(6, test.dividedBy(2).getMinutes()); assertEquals(12, test.getMinutes()); assertEquals(4, test.dividedBy(3).getMinutes()); assertEquals(3, test.dividedBy(4).getMinutes()); assertEquals(2, test.dividedBy(5).getMinutes()); assertEquals(2, test.dividedBy(6).getMinutes()); assertSame(test, test.dividedBy(1)); try { Minutes.ONE.dividedBy(0); fail(); } catch (ArithmeticException ex) { // expected } }
// ----------------------------------------------------------------------- public void testGetMethods() { Minutes test = Minutes.minutes(20); assertEquals(20, test.getMinutes()); }