aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/BaseTest.java (renamed from test/org/traccar/EventHandlerTest.java)2
-rw-r--r--test/org/traccar/FilterHandlerTest.java6
-rw-r--r--test/org/traccar/ProtocolTest.java36
-rw-r--r--test/org/traccar/events/AlertEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/CommandResultEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/IgnitionEventHandlerTest.java4
-rw-r--r--test/org/traccar/events/MotionEventHandlerTest.java4
7 files changed, 14 insertions, 46 deletions
diff --git a/test/org/traccar/EventHandlerTest.java b/test/org/traccar/BaseTest.java
index 423a5084f..0d74f50e5 100644
--- a/test/org/traccar/EventHandlerTest.java
+++ b/test/org/traccar/BaseTest.java
@@ -4,7 +4,7 @@ import org.traccar.database.IdentityManager;
import org.traccar.model.Device;
import org.traccar.model.Position;
-public class EventHandlerTest {
+public class BaseTest {
static {
Context.init(new IdentityManager() {
diff --git a/test/org/traccar/FilterHandlerTest.java b/test/org/traccar/FilterHandlerTest.java
index bb7e69dc0..ea06a490d 100644
--- a/test/org/traccar/FilterHandlerTest.java
+++ b/test/org/traccar/FilterHandlerTest.java
@@ -6,9 +6,11 @@ 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 {
+public class FilterHandlerTest extends BaseTest {
private FilterHandler filtingHandler;
private FilterHandler passingHandler;
@@ -32,7 +34,7 @@ public class FilterHandlerTest {
filtingHandler = null;
passingHandler = null;
}
-
+
private Position createPosition(
long deviceId,
Date time,
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java
index c6c957679..8211e9d6d 100644
--- a/test/org/traccar/ProtocolTest.java
+++ b/test/org/traccar/ProtocolTest.java
@@ -22,41 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.TimeZone;
-public class ProtocolTest {
-
- 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;
- }
-
- });
- }
+public class ProtocolTest extends BaseTest {
protected Position position(String time, boolean valid, double lat, double lon) throws ParseException {
diff --git a/test/org/traccar/events/AlertEventHandlerTest.java b/test/org/traccar/events/AlertEventHandlerTest.java
index c6d5e07d9..77128f066 100644
--- a/test/org/traccar/events/AlertEventHandlerTest.java
+++ b/test/org/traccar/events/AlertEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class AlertEventHandlerTest extends EventHandlerTest {
+public class AlertEventHandlerTest extends BaseTest {
@Test
public void testAlertEventHandler() throws Exception {
diff --git a/test/org/traccar/events/CommandResultEventHandlerTest.java b/test/org/traccar/events/CommandResultEventHandlerTest.java
index b09898b4a..f028e86ee 100644
--- a/test/org/traccar/events/CommandResultEventHandlerTest.java
+++ b/test/org/traccar/events/CommandResultEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class CommandResultEventHandlerTest extends EventHandlerTest {
+public class CommandResultEventHandlerTest extends BaseTest {
@Test
public void testCommandResultEventHandler() throws Exception {
diff --git a/test/org/traccar/events/IgnitionEventHandlerTest.java b/test/org/traccar/events/IgnitionEventHandlerTest.java
index 96df6e1ed..ad329d139 100644
--- a/test/org/traccar/events/IgnitionEventHandlerTest.java
+++ b/test/org/traccar/events/IgnitionEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class IgnitionEventHandlerTest extends EventHandlerTest{
+public class IgnitionEventHandlerTest extends BaseTest {
@Test
public void testIgnitionEventHandler() throws Exception {
diff --git a/test/org/traccar/events/MotionEventHandlerTest.java b/test/org/traccar/events/MotionEventHandlerTest.java
index 34b2c481d..622680d91 100644
--- a/test/org/traccar/events/MotionEventHandlerTest.java
+++ b/test/org/traccar/events/MotionEventHandlerTest.java
@@ -6,11 +6,11 @@ import static org.junit.Assert.assertNotNull;
import java.util.Collection;
import org.junit.Test;
-import org.traccar.EventHandlerTest;
+import org.traccar.BaseTest;
import org.traccar.model.Event;
import org.traccar.model.Position;
-public class MotionEventHandlerTest extends EventHandlerTest {
+public class MotionEventHandlerTest extends BaseTest {
@Test
public void testMotionEventHandler() throws Exception {