aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/events/MotionEventHandlerTest.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-08-17 10:10:05 +0500
committerAbyss777 <abyss@fox5.ru>2017-08-17 10:10:05 +0500
commit1324c00d0ece6e20545fb75f7775a2c6cee2a391 (patch)
tree775ad2a42ebba160d1e36be38c59384cd1da5a1e /test/org/traccar/events/MotionEventHandlerTest.java
parent9476e6be8fae228cda5867750bc4d102b1f9497d (diff)
downloadtrackermap-server-1324c00d0ece6e20545fb75f7775a2c6cee2a391.tar.gz
trackermap-server-1324c00d0ece6e20545fb75f7775a2c6cee2a391.tar.bz2
trackermap-server-1324c00d0ece6e20545fb75f7775a2c6cee2a391.zip
Pass Map<Event, Position> to notifications
Diffstat (limited to 'test/org/traccar/events/MotionEventHandlerTest.java')
-rw-r--r--test/org/traccar/events/MotionEventHandlerTest.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/test/org/traccar/events/MotionEventHandlerTest.java b/test/org/traccar/events/MotionEventHandlerTest.java
index 902be8b87..b88328e58 100644
--- a/test/org/traccar/events/MotionEventHandlerTest.java
+++ b/test/org/traccar/events/MotionEventHandlerTest.java
@@ -10,6 +10,7 @@ import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Map;
import java.util.TimeZone;
import org.junit.Test;
@@ -45,12 +46,13 @@ public class MotionEventHandlerTest extends BaseTest {
nextPosition.set(Position.KEY_MOTION, true);
nextPosition.set(Position.KEY_TOTAL_DISTANCE, 200);
- Event event = motionEventHandler.updateMotionState(deviceState, nextPosition);
- assertNull(event);
+ Map<Event, Position> events = motionEventHandler.updateMotionState(deviceState, nextPosition);
+ assertNull(events);
nextPosition.set(Position.KEY_TOTAL_DISTANCE, 600);
- event = motionEventHandler.updateMotionState(deviceState, nextPosition);
- assertNotNull(event);
+ events = motionEventHandler.updateMotionState(deviceState, nextPosition);
+ assertNotNull(events);
+ Event event = events.keySet().iterator().next();
assertEquals(Event.TYPE_DEVICE_MOVING, event.getType());
assertTrue(deviceState.getMotionState());
assertNull(deviceState.getMotionPosition());
@@ -59,8 +61,9 @@ public class MotionEventHandlerTest extends BaseTest {
deviceState.setMotionPosition(position);
nextPosition.setTime(date("2017-01-01 00:06:00"));
nextPosition.set(Position.KEY_TOTAL_DISTANCE, 200);
- event = motionEventHandler.updateMotionState(deviceState, nextPosition);
+ events = motionEventHandler.updateMotionState(deviceState, nextPosition);
assertNotNull(event);
+ event = events.keySet().iterator().next();
assertEquals(Event.TYPE_DEVICE_MOVING, event.getType());
assertTrue(deviceState.getMotionState());
assertNull(deviceState.getMotionPosition());
@@ -78,9 +81,10 @@ public class MotionEventHandlerTest extends BaseTest {
deviceState.setMotionState(false);
deviceState.setMotionPosition(position);
- Event event = motionEventHandler.updateMotionState(deviceState);
+ Map<Event, Position> events = motionEventHandler.updateMotionState(deviceState);
- assertNotNull(event);
+ assertNotNull(events);
+ Event event = events.keySet().iterator().next();
assertEquals(Event.TYPE_DEVICE_MOVING, event.getType());
assertTrue(deviceState.getMotionState());
assertNull(deviceState.getMotionPosition());
@@ -104,8 +108,9 @@ public class MotionEventHandlerTest extends BaseTest {
nextPosition.set(Position.KEY_MOTION, false);
nextPosition.set(Position.KEY_IGNITION, false);
- Event event = motionEventHandler.updateMotionState(deviceState, nextPosition);
- assertNotNull(event);
+ Map<Event, Position> events = motionEventHandler.updateMotionState(deviceState, nextPosition);
+ assertNotNull(events);
+ Event event = events.keySet().iterator().next();
assertEquals(Event.TYPE_DEVICE_STOPPED, event.getType());
assertFalse(deviceState.getMotionState());
assertNull(deviceState.getMotionPosition());