aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/traccar')
-rw-r--r--src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java b/src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java
index 22afbfa52..25c766b51 100644
--- a/src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java
+++ b/src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java
@@ -1,5 +1,6 @@
package org.traccar.handler.events;
+import org.junit.Ignore;
import org.junit.Test;
import org.traccar.BaseTest;
import org.traccar.model.Event;
@@ -61,6 +62,38 @@ public class MotionEventHandlerTest extends BaseTest {
verifyState(state, false, 0);
}
+ @Ignore
+ @Test
+ public void testMotionFluctuation() throws ParseException {
+ TripsConfig tripsConfig = new TripsConfig(500, 300000, 300000, 0, false, false, 0.01);
+
+ MotionState state = new MotionState();
+
+ MotionProcessor.updateState(state, position("2017-01-01 00:00:00", false, 0, null), false, tripsConfig);
+ assertNull(state.getEvent());
+ verifyState(state, false, 0);
+
+ MotionProcessor.updateState(state, position("2017-01-01 00:02:00", true, 100, null), true, tripsConfig);
+ assertNull(state.getEvent());
+ verifyState(state, true, 100);
+
+ MotionProcessor.updateState(state, position("2017-01-01 00:02:00", true, 700, null), true, tripsConfig);
+ assertEquals(Event.TYPE_DEVICE_MOVING, state.getEvent().getType());
+ verifyState(state, true, 0);
+
+ MotionProcessor.updateState(state, position("2017-01-01 00:03:00", false, 700, null), false, tripsConfig);
+ assertNull(state.getEvent());
+ verifyState(state, false, 700);
+
+ MotionProcessor.updateState(state, position("2017-01-01 00:04:00", true, 1000, null), true, tripsConfig);
+ assertNull(state.getEvent());
+ verifyState(state, true, 1000);
+
+ MotionProcessor.updateState(state, position("2017-01-01 00:06:00", true, 2000, null), true, tripsConfig);
+ assertNull(state.getEvent());
+ verifyState(state, true, 2000);
+ }
+
@Test
public void testStopWithPositionIgnition() throws ParseException {
TripsConfig tripsConfig = new TripsConfig(500, 300000, 300000, 0, true, false, 0.01);