mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-21 21:25:38 +00:00
failing test for open ended device mapping finder
This commit is contained in:
-3
@@ -41,13 +41,10 @@ public class DependentStartTimeFinderTest {
|
||||
@Before
|
||||
public void setUp() {
|
||||
author = new LogEventAuthorImpl("Test", 1);
|
||||
|
||||
raceLogA = new RaceLogImpl("raceLogA");
|
||||
raceLogB = new RaceLogImpl("raceLogB");
|
||||
raceLogC = new RaceLogImpl("raceLogC");
|
||||
|
||||
nowMock = mock(TimePoint.class);
|
||||
|
||||
raceLogResolver = new RaceLogResolver() {
|
||||
@Override
|
||||
public RaceLog resolve(SimpleRaceLogIdentifier identifier) {
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.sap.sailing.domain.regattalog.tracking.analyzing.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceMarkMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.impl.OpenEndedDeviceMappingFinder;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.impl.MarkImpl;
|
||||
import com.sap.sailing.domain.racelogtracking.impl.SmartphoneUUIDIdentifierImpl;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class OpenEndedDeviceMappingFinderTest extends AbstractRegattaLogTrackingTest {
|
||||
private OpenEndedDeviceMappingFinder finder;
|
||||
private Mark mappedToMark;
|
||||
private UUID deviceUuid;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mappedToMark = new MarkImpl(UUID.randomUUID(), "Random Mark");
|
||||
deviceUuid = UUID.randomUUID();
|
||||
finder = new OpenEndedDeviceMappingFinder(log, mappedToMark, deviceUuid.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findNoOpenEndedMappingBecauseNoMappingExistsAtAll() {
|
||||
assertNull(finder.analyze()); // no event in the log, so result is expected to be null
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findNoOpenEndedMappingBecauseAllMappingsAreClosed() {
|
||||
final RegattaLogDeviceMarkMappingEventImpl mappingEvent1 = new RegattaLogDeviceMarkMappingEventImpl(MillisecondsTimePoint.now(), author, mappedToMark,
|
||||
new SmartphoneUUIDIdentifierImpl(deviceUuid), MillisecondsTimePoint.now(), MillisecondsTimePoint.now().plus(Duration.ONE_HOUR));
|
||||
log.add(mappingEvent1);
|
||||
final RegattaLogDeviceMarkMappingEventImpl mappingEvent2 = new RegattaLogDeviceMarkMappingEventImpl(MillisecondsTimePoint.now().plus(Duration.ONE_YEAR), author, mappedToMark,
|
||||
new SmartphoneUUIDIdentifierImpl(deviceUuid), MillisecondsTimePoint.now(), MillisecondsTimePoint.now().plus(Duration.ONE_YEAR).plus(Duration.ONE_HOUR));
|
||||
log.add(mappingEvent2);
|
||||
assertNull(finder.analyze()); // both events are closed; expect result to be null
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findOpenEndedMappingWhenItsLastOfSeveral() {
|
||||
final RegattaLogDeviceMarkMappingEventImpl mappingEvent1 = new RegattaLogDeviceMarkMappingEventImpl(MillisecondsTimePoint.now(), author, mappedToMark,
|
||||
new SmartphoneUUIDIdentifierImpl(deviceUuid), MillisecondsTimePoint.now(), MillisecondsTimePoint.now().plus(Duration.ONE_HOUR));
|
||||
log.add(mappingEvent1);
|
||||
final RegattaLogDeviceMarkMappingEventImpl mappingEvent2 = new RegattaLogDeviceMarkMappingEventImpl(MillisecondsTimePoint.now().plus(Duration.ONE_YEAR), author, mappedToMark,
|
||||
new SmartphoneUUIDIdentifierImpl(deviceUuid), MillisecondsTimePoint.now(), /* open end */ null);
|
||||
log.add(mappingEvent2);
|
||||
assertEquals(mappingEvent2.getId(), finder.analyze());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findOpenEndedMappingWhenItsFirstOfSeveral() {
|
||||
final RegattaLogDeviceMarkMappingEventImpl mappingEvent1 = new RegattaLogDeviceMarkMappingEventImpl(MillisecondsTimePoint.now(), author, mappedToMark,
|
||||
new SmartphoneUUIDIdentifierImpl(deviceUuid), MillisecondsTimePoint.now(), /* open end */ null);
|
||||
log.add(mappingEvent1);
|
||||
final RegattaLogDeviceMarkMappingEventImpl mappingEvent2 = new RegattaLogDeviceMarkMappingEventImpl(MillisecondsTimePoint.now().plus(Duration.ONE_YEAR), author, mappedToMark,
|
||||
new SmartphoneUUIDIdentifierImpl(deviceUuid), MillisecondsTimePoint.now(), MillisecondsTimePoint.now().plus(Duration.ONE_YEAR).plus(Duration.ONE_HOUR));
|
||||
log.add(mappingEvent1);
|
||||
assertEquals(mappingEvent2.getId(), finder.analyze());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user