Search in sources :

Example 1 with UserActiveInterval

use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval in project watchdog by TestRoots.

the class IntervalComparisonTest method testComparisonEqualIntervalsDifferentObjectsDifferentType.

@Test
public void testComparisonEqualIntervalsDifferentObjectsDifferentType() {
    Date start = new Date();
    UserActiveInterval interval1 = new UserActiveInterval(start);
    IDEOpenInterval interval2 = new IDEOpenInterval(start);
    interval1.close();
    interval2.close();
    interval2.setEndTime(interval1.getEnd());
    assertEquals(1, interval1.compareTo(interval2));
    assertEquals(-1, interval2.compareTo(interval1));
}
Also used : UserActiveInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval) Date(java.util.Date) IDEOpenInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval) Test(org.junit.Test)

Example 2 with UserActiveInterval

use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval in project watchdog by TestRoots.

the class IntervalComparisonTest method testComparisonTwoDifferentIntervalsDifferentType.

@Test
public void testComparisonTwoDifferentIntervalsDifferentType() {
    UserActiveInterval interval1 = new UserActiveInterval(new Date(1));
    IDEOpenInterval interval2 = new IDEOpenInterval(new Date(2));
    interval1.close();
    interval1.setEndTime(new Date(2));
    interval2.close();
    interval2.setEndTime(new Date(3));
    assertEquals(-1, interval1.compareTo(interval2));
    assertEquals(1, interval2.compareTo(interval1));
}
Also used : UserActiveInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval) Date(java.util.Date) IDEOpenInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval) Test(org.junit.Test)

Example 3 with UserActiveInterval

use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval in project watchdog by TestRoots.

the class IntervalComparisonTest method testComparisonEqualIntervalsDifferentObjectsSameType.

@Test
public void testComparisonEqualIntervalsDifferentObjectsSameType() {
    Date start = new Date();
    UserActiveInterval interval1 = new UserActiveInterval(start);
    UserActiveInterval interval2 = new UserActiveInterval(start);
    Date end = new Date();
    interval1.close();
    interval1.setEndTime(end);
    interval2.close();
    interval2.setEndTime(end);
    assertEquals(0, interval1.compareTo(interval2));
}
Also used : UserActiveInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval) Date(java.util.Date) Test(org.junit.Test)

Example 4 with UserActiveInterval

use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval in project watchdog by TestRoots.

the class IntervalComparisonTest method testComparisonTwoDifferentIntervalsSameType.

@Test
public void testComparisonTwoDifferentIntervalsSameType() {
    UserActiveInterval interval1 = new UserActiveInterval(new Date(1));
    UserActiveInterval interval2 = new UserActiveInterval(new Date(2));
    interval1.close();
    interval1.setEndTime(new Date(2));
    interval2.close();
    interval2.setEndTime(new Date(3));
    assertEquals(-1, interval1.compareTo(interval2));
    assertEquals(1, interval2.compareTo(interval1));
}
Also used : UserActiveInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval) Date(java.util.Date) Test(org.junit.Test)

Example 5 with UserActiveInterval

use of nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval in project watchdog by TestRoots.

the class IntervalComparisonTest method testComparisonEqualIntervalsDifferentObjectsDifferentStart.

@Test
public void testComparisonEqualIntervalsDifferentObjectsDifferentStart() {
    UserActiveInterval interval1 = new UserActiveInterval(new Date(1));
    UserActiveInterval interval2 = new UserActiveInterval(new Date(2));
    interval1.close();
    interval2.close();
    interval2.setEndTime(interval1.getEnd());
    assertEquals(-1, interval1.compareTo(interval2));
    assertEquals(1, interval2.compareTo(interval1));
}
Also used : UserActiveInterval(nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval) Date(java.util.Date) Test(org.junit.Test)

Aggregations

Date (java.util.Date)6 UserActiveInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.UserActiveInterval)6 Test (org.junit.Test)6 IDEOpenInterval (nl.tudelft.watchdog.core.logic.interval.intervaltypes.IDEOpenInterval)2