コード例 #1
0
  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
    }
  }
コード例 #2
0
  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
    }
  }