コード例 #1
0
 @Test
 public void testTotalTime() {
   driver.setStartTime(new EnduroTime("12.00.00"));
   driver.setFinishTime(new EnduroTime("13.01.01"));
   assertEquals("01.01.01", driver.getTotalTime());
   driver.setStartTime(new EnduroTime("12.05.00"));
   assertEquals("01.01.01", driver.getTotalTime());
 }
コード例 #2
0
  @Test
  public void testComparable() {
    MarathonDriver driver2 = new MarathonDriver(2);
    driver.setStartTime(new EnduroTime("12.00.00"));
    driver.setFinishTime(new EnduroTime("13.00.00"));

    driver2.setStartTime(new EnduroTime("12.00.00"));
    driver2.setFinishTime(new EnduroTime("12.30.00"));

    assertTrue(driver.compareTo(driver2) > 0);
  }
コード例 #3
0
 @Test
 public void compareDriverWithoutTotalTimeToOneWithTotalTime() {
   MarathonDriver driver2 = new MarathonDriver(2);
   MarathonDriver driver3 = new MarathonDriver(3);
   driver3.setStartTime(new EnduroTime("12.00.00"));
   driver3.setFinishTime(new EnduroTime("12.15.13"));
   assertEquals(-1, driver3.compareTo(driver2));
 }
コード例 #4
0
  @Test
  public void testStartFinishString() {
    driver.setStartTime(new EnduroTime("12.00.00"));
    driver.setStartTime(new EnduroTime("12.01.00"));
    driver.setFinishTime(new EnduroTime("13.00.00"));
    driver.setFinishTime(new EnduroTime("13.01.00"));

    assertEquals("12.00.00,12.01.00", driver.getStartTimeString());
    assertEquals("13.00.00,13.01.00", driver.getFinishTimeString());
  }
コード例 #5
0
  @Test
  public void testAddEmptyList() {
    driver.setStartTime(new EnduroTime("12.00.00"));
    driver.setStartTime(new EnduroTime("12.01.00"));
    driver.setFinishTime(new EnduroTime("13.00.00"));
    driver.setFinishTime(new EnduroTime("13.01.00"));

    ArrayList<EnduroTime> compare = driver.getStartTimes();

    driver.setStartTimes(new ArrayList<EnduroTime>());

    assertEquals(compare, driver.getStartTimes());
  }
コード例 #6
0
  @Test
  public void testAddList() {
    driver.setStartTime(new EnduroTime("12.00.00"));
    driver.setStartTime(new EnduroTime("12.01.00"));
    driver.setFinishTime(new EnduroTime("13.00.00"));
    driver.setFinishTime(new EnduroTime("13.01.00"));

    ArrayList<EnduroTime> result = driver.getStartTimes();
    result.add(new EnduroTime("00.00.00"));
    result.add(new EnduroTime("10.10.00"));

    ArrayList<EnduroTime> test = new ArrayList<EnduroTime>();
    test.add(new EnduroTime("00.00.00"));
    test.add(new EnduroTime("10.10.00"));

    driver.setStartTimes(test);
    assertEquals(result, driver.getStartTimes());
  }
コード例 #7
0
 @Test
 public void testPutTime() {
   driver.setStartTime(new EnduroTime("12.00.00"));
   assertEquals("12.00.00", driver.getStartTimes().get(0).toString());
   assertEquals("12.00.00", driver.getStartTimeString());
 }