Esempio n. 1
0
  // -----------------------------------------------------------------------
  public void testPlus_int() {
    Minutes test2 = Minutes.minutes(2);
    Minutes result = test2.plus(3);
    assertEquals(2, test2.getMinutes());
    assertEquals(5, result.getMinutes());

    assertEquals(1, Minutes.ONE.plus(0).getMinutes());

    try {
      Minutes.MAX_VALUE.plus(1);
      fail();
    } catch (ArithmeticException ex) {
      // expected
    }
  }
Esempio n. 2
0
  public void testPlus_Minutes() {
    Minutes test2 = Minutes.minutes(2);
    Minutes test3 = Minutes.minutes(3);
    Minutes result = test2.plus(test3);
    assertEquals(2, test2.getMinutes());
    assertEquals(3, test3.getMinutes());
    assertEquals(5, result.getMinutes());

    assertEquals(1, Minutes.ONE.plus(Minutes.ZERO).getMinutes());
    assertEquals(1, Minutes.ONE.plus((Minutes) null).getMinutes());

    try {
      Minutes.MAX_VALUE.plus(Minutes.ONE);
      fail();
    } catch (ArithmeticException ex) {
      // expected
    }
  }