From 838e60102dca8e0d9abaf4439493f7226fc3ef88 Mon Sep 17 00:00:00 2001 From: Renaud Allard Date: Thu, 20 Oct 2016 09:37:37 +0200 Subject: Create a BaseTest class and reuse it --- test/org/traccar/BaseTest.java | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/org/traccar/BaseTest.java (limited to 'test/org/traccar/BaseTest.java') diff --git a/test/org/traccar/BaseTest.java b/test/org/traccar/BaseTest.java new file mode 100644 index 000000000..0d74f50e5 --- /dev/null +++ b/test/org/traccar/BaseTest.java @@ -0,0 +1,43 @@ +package org.traccar; + +import org.traccar.database.IdentityManager; +import org.traccar.model.Device; +import org.traccar.model.Position; + +public class BaseTest { + + 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; + } + + }); + } + +} -- cgit v1.2.3