Esempio n. 1
0
 /**
  * {@link MinuteOfHour#toString()}のテスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 public void test11_toString() throws Exception {
   for (int i = 1; i < 10; i++) {
     MinuteOfHour m = MinuteOfHour.valueOf(i);
     assertThat(m.toString(), is(String.format("%02d", i)));
   }
   for (int i = 10; i < 60; i++) {
     MinuteOfHour m = MinuteOfHour.valueOf(i);
     assertThat(m.toString(), is(String.valueOf(i)));
   }
 }
Esempio n. 2
0
 /**
  * {@link MinuteOfHour#equals(Object)}のテスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 @SuppressWarnings("serial")
 public void test10_equals() throws Exception {
   MinuteOfHour m14 = MinuteOfHour.valueOf(14);
   assertThat(m14.equals(m14), is(true));
   assertThat(m14.equals(MinuteOfHour.valueOf(14)), is(true));
   assertThat(m14.equals(MinuteOfHour.valueOf(15)), is(false));
   assertThat(m14.equals(null), is(false));
   assertThat(m14.equals(new MinuteOfHour(14)), is(true));
   assertThat(m14.equals(new MinuteOfHour(14) {}), is(false));
 }
Esempio n. 3
0
 /**
  * {@link MinuteOfHour#valueOf(int)}の不正引数テスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 public void test03_GreaterThan() throws Exception {
   try {
     MinuteOfHour.valueOf(60);
     fail();
   } catch (IllegalArgumentException ex) {
     // success
   }
 }
Esempio n. 4
0
 /**
  * {@link MinuteOfHour#valueOf(int)}の不正引数テスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 public void test02_IllegalLessThanZero() throws Exception {
   try {
     MinuteOfHour.valueOf(-1);
     fail();
   } catch (IllegalArgumentException ex) {
     // success
   }
 }
Esempio n. 5
0
 /**
  * {@link MinuteOfHour#isAfter(MinuteOfHour)}のテスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 public void test05_EarlierAfterLater() throws Exception {
   MinuteOfHour earlier = MinuteOfHour.valueOf(15);
   MinuteOfHour later = MinuteOfHour.valueOf(45);
   assertThat(earlier.isAfter(later), is(false));
 }
Esempio n. 6
0
 /**
  * {@link MinuteOfHour#valueOf(int)}のテスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 public void test01_Simple() throws Exception {
   assertThat(MinuteOfHour.valueOf(11).breachEncapsulationOfValue(), is(11));
   assertThat(MinuteOfHour.valueOf(23), is(MinuteOfHour.valueOf(23)));
 }
Esempio n. 7
0
 /**
  * {@link MinuteOfHour#isBefore(MinuteOfHour)}のテスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 public void test09_EqualBeforeEqual() throws Exception {
   MinuteOfHour anMinute = MinuteOfHour.valueOf(15);
   MinuteOfHour anotherMinute = MinuteOfHour.valueOf(15);
   assertThat(anMinute.isBefore(anotherMinute), is(false));
 }
Esempio n. 8
0
 /**
  * {@link MinuteOfHour#isBefore(MinuteOfHour)}のテスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 public void test08_EarlierBeforeLater() throws Exception {
   MinuteOfHour earlier = MinuteOfHour.valueOf(15);
   MinuteOfHour later = MinuteOfHour.valueOf(45);
   assertThat(earlier.isBefore(later), is(true));
 }
Esempio n. 9
0
 /**
  * {@link MinuteOfHour#isAfter(MinuteOfHour)}のテスト。
  *
  * @throws Exception 例外が発生した場合
  */
 @Test
 public void test06_EqualAfterEqual() throws Exception {
   MinuteOfHour anMinute = MinuteOfHour.valueOf(45);
   MinuteOfHour anotherMinute = MinuteOfHour.valueOf(45);
   assertThat(anMinute.isAfter(anotherMinute), is(false));
 }