use of nl.tudelft.watchdog.core.logic.event.eventtypes.EventBase in project watchdog by TestRoots.
the class EventPersisterDuplicatesTest method test1AddEvent.
@Test
public void test1AddEvent() {
event = createEvent();
persister.save(event);
WatchDogItem item = new ArrayList<>(persister.readItems()).get(0);
assertTrue(item instanceof EventBase);
EventBase savedEvent = (EventBase) item;
assertEquals(event.getType(), savedEvent.getType());
assertEquals(event.getTimestamp(), savedEvent.getTimestamp());
}
use of nl.tudelft.watchdog.core.logic.event.eventtypes.EventBase in project watchdog by TestRoots.
the class EventPersisterDuplicatesTest method createEvent.
private static EventBase createEvent() {
EventBase event = new BreakpointAddEvent(1, BreakpointType.LINE, new Date(1));
event.setSessionSeed("444");
return event;
}
use of nl.tudelft.watchdog.core.logic.event.eventtypes.EventBase in project watchdog by TestRoots.
the class EventPersisterTest method testInteraction.
private void testInteraction(int items) {
List<EventBase> generatedEvents = generateEventList(items);
// Shuffle the generated events to test for
// correct ordering of returned values
Collections.shuffle(generatedEvents);
Collections.sort(generatedEvents);
for (EventBase event : generatedEvents) {
persister.save(event);
}
List<WatchDogItem> readEvents = new ArrayList<WatchDogItem>(persister.readItems());
assertEquals(readEvents.size(), items);
// Test order of returned results
assertEquals(readEvents, generatedEvents);
}
use of nl.tudelft.watchdog.core.logic.event.eventtypes.EventBase in project watchdog by TestRoots.
the class EventPersisterTest method createRandomEvent.
public static EventBase createRandomEvent() {
EventBase event = new BreakpointAddEvent(new Random().nextInt(100000), BreakpointType.LINE, new Date());
event.setSessionSeed("444");
event.setTimestamp(new Date(event.getTimestamp().getTime() + (new Random()).nextInt(100000)));
return event;
}
use of nl.tudelft.watchdog.core.logic.event.eventtypes.EventBase in project watchdog by TestRoots.
the class EventPersisterTestSingleEvent method test2CompareEventAfterWrite.
@Test
public void test2CompareEventAfterWrite() {
WatchDogItem item = new ArrayList<>(persister.readItems()).get(0);
assertTrue(item instanceof EventBase);
EventBase savedEvent = (EventBase) item;
assertEquals(event.getType(), savedEvent.getType());
assertEquals(event.getTimestamp(), savedEvent.getTimestamp());
}
Aggregations