aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/handler
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-12-14 15:37:54 -0800
committerAnton Tananaev <anton@traccar.org>2022-12-14 15:37:54 -0800
commit836dc4138fdcf560a31c6a90769b19f6a0d0e438 (patch)
treebd696ae5f80ff0d6cac35ac878396b500c9d6e15 /src/test/java/org/traccar/handler
parent11f90f5b779e9af3a22907766254f3400ef8bc50 (diff)
downloadtrackermap-server-836dc4138fdcf560a31c6a90769b19f6a0d0e438.tar.gz
trackermap-server-836dc4138fdcf560a31c6a90769b19f6a0d0e438.tar.bz2
trackermap-server-836dc4138fdcf560a31c6a90769b19f6a0d0e438.zip
Add motion fluctuation test
Diffstat (limited to 'src/test/java/org/traccar/handler')
-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);