diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/org/traccar/FilterHandlerTest.java | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java index bb7e69dc0..9c2ce416e 100644 --- a/test/org/traccar/FilterHandlerTest.java +++ b/test/org/traccar/FilterHandlerTest.java @@ -6,10 +6,46 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import org.junit.Before; import org.junit.Test; +import org.traccar.database.IdentityManager; import org.traccar.model.Position; +import org.traccar.model.Device; public class FilterHandlerTest { + static { + Context.init(new IdentityManager() { + + private Device createDevice() { + Device device = new Device(); + device.setId(1); + device.setName("test"); + device.setUniqueId("123456789012345"); + return device; + } + + @Override + public Device getDeviceById(long id) { + return createDevice(); + } + + @Override + public Device getDeviceByUniqueId(String uniqueId) { + return createDevice(); + } + + @Override + public Position getLastPosition(long deviceId) { + return null; + } + + @Override + public boolean isLatestPosition(Position position) { + return true; + } + + }); + } + private FilterHandler filtingHandler; private FilterHandler passingHandler; @@ -32,7 +68,7 @@ public class FilterHandlerTest { filtingHandler = null; passingHandler = null; } - + private Position createPosition( long deviceId, Date time, |