diff options
22 files changed, 87 insertions, 90 deletions
diff --git a/src/test/java/org/traccar/BaseTest.java b/src/test/java/org/traccar/BaseTest.java index 40ac76601..a34524c43 100644 --- a/src/test/java/org/traccar/BaseTest.java +++ b/src/test/java/org/traccar/BaseTest.java @@ -1,22 +1,16 @@ package org.traccar; import io.netty.channel.Channel; -import org.mockito.ArgumentCaptor; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; import org.traccar.config.Config; -import org.traccar.session.ConnectionManager; import org.traccar.database.IdentityManager; import org.traccar.database.MediaManager; import org.traccar.database.StatisticsManager; import org.traccar.model.Device; +import org.traccar.session.ConnectionManager; import org.traccar.session.DeviceSession; import java.net.SocketAddress; -import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; -import java.util.TimeZone; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; diff --git a/src/test/java/org/traccar/calendar/CalendarTest.java b/src/test/java/org/traccar/calendar/CalendarTest.java index 56406d4b8..def67ff76 100644 --- a/src/test/java/org/traccar/calendar/CalendarTest.java +++ b/src/test/java/org/traccar/calendar/CalendarTest.java @@ -1,5 +1,9 @@ package org.traccar.calendar; +import net.fortuna.ical4j.data.ParserException; +import org.junit.Test; +import org.traccar.model.Calendar; + import java.io.IOException; import java.sql.SQLException; import java.text.DateFormat; @@ -7,11 +11,6 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import org.junit.Test; -import org.traccar.model.Calendar; - -import net.fortuna.ical4j.data.ParserException; - import static org.junit.Assert.assertTrue; public class CalendarTest { diff --git a/src/test/java/org/traccar/config/ConfigTest.java b/src/test/java/org/traccar/config/ConfigTest.java index 13d0ffb04..8ba6dace6 100644 --- a/src/test/java/org/traccar/config/ConfigTest.java +++ b/src/test/java/org/traccar/config/ConfigTest.java @@ -1,8 +1,8 @@ package org.traccar.config; import org.junit.Test; + import static org.junit.Assert.assertEquals; -import org.traccar.config.Config; public class ConfigTest { diff --git a/src/test/java/org/traccar/geocoder/GeocoderTest.java b/src/test/java/org/traccar/geocoder/GeocoderTest.java index 91431fd6a..6a85777b1 100644 --- a/src/test/java/org/traccar/geocoder/GeocoderTest.java +++ b/src/test/java/org/traccar/geocoder/GeocoderTest.java @@ -1,10 +1,10 @@ package org.traccar.geocoder; -import java.util.Locale; - import org.junit.Ignore; import org.junit.Test; +import java.util.Locale; + import static org.junit.Assert.assertEquals; public class GeocoderTest { diff --git a/src/test/java/org/traccar/geofence/GeofenceCircleTest.java b/src/test/java/org/traccar/geofence/GeofenceCircleTest.java index 259a8fb77..038e4b6d6 100644 --- a/src/test/java/org/traccar/geofence/GeofenceCircleTest.java +++ b/src/test/java/org/traccar/geofence/GeofenceCircleTest.java @@ -1,9 +1,9 @@ package org.traccar.geofence; -import java.text.ParseException; - import org.junit.Test; +import java.text.ParseException; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/org/traccar/geofence/GeofencePolygonTest.java b/src/test/java/org/traccar/geofence/GeofencePolygonTest.java index cc9c46c94..1b8de68ad 100644 --- a/src/test/java/org/traccar/geofence/GeofencePolygonTest.java +++ b/src/test/java/org/traccar/geofence/GeofencePolygonTest.java @@ -1,9 +1,9 @@ package org.traccar.geofence; -import java.text.ParseException; - import org.junit.Test; +import java.text.ParseException; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/org/traccar/geofence/GeofencePolylineTest.java b/src/test/java/org/traccar/geofence/GeofencePolylineTest.java index 1e9dcb7c3..0e8905319 100644 --- a/src/test/java/org/traccar/geofence/GeofencePolylineTest.java +++ b/src/test/java/org/traccar/geofence/GeofencePolylineTest.java @@ -1,9 +1,9 @@ package org.traccar.geofence; -import java.text.ParseException; - import org.junit.Test; +import java.text.ParseException; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/org/traccar/handler/ComputedAttributesTest.java b/src/test/java/org/traccar/handler/ComputedAttributesTest.java index a76d8169b..e3886317c 100644 --- a/src/test/java/org/traccar/handler/ComputedAttributesTest.java +++ b/src/test/java/org/traccar/handler/ComputedAttributesTest.java @@ -1,12 +1,12 @@ package org.traccar.handler; -import java.util.Date; - import org.junit.Test; import org.traccar.config.Config; import org.traccar.model.Attribute; import org.traccar.model.Position; +import java.util.Date; + import static org.junit.Assert.assertEquals; public class ComputedAttributesTest { diff --git a/src/test/java/org/traccar/handler/FilterHandlerTest.java b/src/test/java/org/traccar/handler/FilterHandlerTest.java index 49bbf70b5..10d6768cf 100644 --- a/src/test/java/org/traccar/handler/FilterHandlerTest.java +++ b/src/test/java/org/traccar/handler/FilterHandlerTest.java @@ -9,10 +9,13 @@ import org.traccar.database.DataManager; import org.traccar.database.IdentityManager; import org.traccar.model.Device; import org.traccar.model.Position; + import java.util.Date; + import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class FilterHandlerTest extends BaseTest { diff --git a/src/test/java/org/traccar/handler/MotionHandlerTest.java b/src/test/java/org/traccar/handler/MotionHandlerTest.java index fdbd48334..aa73ac60a 100644 --- a/src/test/java/org/traccar/handler/MotionHandlerTest.java +++ b/src/test/java/org/traccar/handler/MotionHandlerTest.java @@ -1,12 +1,13 @@ package org.traccar.handler; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.*; - import org.junit.Test; import org.traccar.model.Position; import org.traccar.reports.model.TripsConfig; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + public class MotionHandlerTest { @Test diff --git a/src/test/java/org/traccar/handler/events/AlertEventHandlerTest.java b/src/test/java/org/traccar/handler/events/AlertEventHandlerTest.java index 4934695ad..d6cf32ca3 100644 --- a/src/test/java/org/traccar/handler/events/AlertEventHandlerTest.java +++ b/src/test/java/org/traccar/handler/events/AlertEventHandlerTest.java @@ -1,11 +1,5 @@ package org.traccar.handler.events; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; - -import java.util.Map; - import org.junit.Test; import org.traccar.BaseTest; import org.traccar.config.Config; @@ -13,6 +7,12 @@ import org.traccar.database.IdentityManager; import org.traccar.model.Event; import org.traccar.model.Position; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; + public class AlertEventHandlerTest extends BaseTest { @Test diff --git a/src/test/java/org/traccar/handler/events/CommandResultEventHandlerTest.java b/src/test/java/org/traccar/handler/events/CommandResultEventHandlerTest.java index 0ccf9f6b4..4997a0e0f 100644 --- a/src/test/java/org/traccar/handler/events/CommandResultEventHandlerTest.java +++ b/src/test/java/org/traccar/handler/events/CommandResultEventHandlerTest.java @@ -1,15 +1,15 @@ package org.traccar.handler.events; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.Map; - import org.junit.Test; import org.traccar.BaseTest; import org.traccar.model.Event; import org.traccar.model.Position; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + public class CommandResultEventHandlerTest extends BaseTest { @Test diff --git a/src/test/java/org/traccar/handler/events/IgnitionEventHandlerTest.java b/src/test/java/org/traccar/handler/events/IgnitionEventHandlerTest.java index f568b6a74..0de80dd70 100644 --- a/src/test/java/org/traccar/handler/events/IgnitionEventHandlerTest.java +++ b/src/test/java/org/traccar/handler/events/IgnitionEventHandlerTest.java @@ -1,16 +1,16 @@ package org.traccar.handler.events; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.mock; - -import java.util.Map; - import org.junit.Test; import org.traccar.BaseTest; import org.traccar.database.IdentityManager; import org.traccar.model.Event; import org.traccar.model.Position; +import java.util.Map; + +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.mock; + public class IgnitionEventHandlerTest extends BaseTest { @Test diff --git a/src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java b/src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java index 8d84e3125..94dab4049 100644 --- a/src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java +++ b/src/test/java/org/traccar/handler/events/MotionEventHandlerTest.java @@ -1,10 +1,11 @@ package org.traccar.handler.events; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import org.junit.Test; +import org.traccar.BaseTest; +import org.traccar.model.Event; +import org.traccar.model.Position; +import org.traccar.reports.model.TripsConfig; +import org.traccar.session.DeviceState; import java.text.DateFormat; import java.text.ParseException; @@ -13,12 +14,11 @@ import java.util.Date; import java.util.Map; import java.util.TimeZone; -import org.junit.Test; -import org.traccar.BaseTest; -import org.traccar.session.DeviceState; -import org.traccar.model.Event; -import org.traccar.model.Position; -import org.traccar.reports.model.TripsConfig; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; public class MotionEventHandlerTest extends BaseTest { diff --git a/src/test/java/org/traccar/handler/events/OverspeedEventHandlerTest.java b/src/test/java/org/traccar/handler/events/OverspeedEventHandlerTest.java index 5c4cce1b6..9e86031e8 100644 --- a/src/test/java/org/traccar/handler/events/OverspeedEventHandlerTest.java +++ b/src/test/java/org/traccar/handler/events/OverspeedEventHandlerTest.java @@ -1,9 +1,12 @@ package org.traccar.handler.events; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; +import org.junit.Test; +import org.traccar.BaseTest; +import org.traccar.config.Config; +import org.traccar.config.Keys; +import org.traccar.model.Event; +import org.traccar.model.Position; +import org.traccar.session.DeviceState; import java.text.DateFormat; import java.text.ParseException; @@ -12,13 +15,10 @@ import java.util.Date; import java.util.Map; import java.util.TimeZone; -import org.junit.Test; -import org.traccar.BaseTest; -import org.traccar.config.Config; -import org.traccar.config.Keys; -import org.traccar.session.DeviceState; -import org.traccar.model.Event; -import org.traccar.model.Position; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; public class OverspeedEventHandlerTest extends BaseTest { diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java index c8db31ad0..98c587a81 100644 --- a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -1,8 +1,7 @@ package org.traccar.protocol; -import org.traccar.ProtocolTest; - import org.junit.Test; +import org.traccar.ProtocolTest; public class Jt600ProtocolDecoderTest extends ProtocolTest { diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java index 51cefb962..fdd73b9ce 100644 --- a/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java +++ b/src/test/java/org/traccar/protocol/Jt600ProtocolEncoderTest.java @@ -1,11 +1,11 @@ package org.traccar.protocol; -import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.traccar.ProtocolTest; import org.traccar.model.Command; +import static org.junit.Assert.assertEquals; + public class Jt600ProtocolEncoderTest extends ProtocolTest { Jt600ProtocolEncoder encoder = new Jt600ProtocolEncoder(null); Command command = new Command(); diff --git a/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java index ea55a8b1c..964c59927 100644 --- a/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/MegastekProtocolDecoderTest.java @@ -1,8 +1,8 @@ package org.traccar.protocol; import org.junit.Test; -import org.traccar.model.Position; import org.traccar.ProtocolTest; +import org.traccar.model.Position; public class MegastekProtocolDecoderTest extends ProtocolTest { diff --git a/src/test/java/org/traccar/protocol/NavisFrameDecoderTest.java b/src/test/java/org/traccar/protocol/NavisFrameDecoderTest.java index 0ebfeacd2..29327f7e1 100644 --- a/src/test/java/org/traccar/protocol/NavisFrameDecoderTest.java +++ b/src/test/java/org/traccar/protocol/NavisFrameDecoderTest.java @@ -1,8 +1,7 @@ package org.traccar.protocol; -import org.traccar.ProtocolTest; - import org.junit.Test; +import org.traccar.ProtocolTest; public class NavisFrameDecoderTest extends ProtocolTest { diff --git a/src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java index 5c841b211..960ed1442 100644 --- a/src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/NavisProtocolDecoderTest.java @@ -1,8 +1,7 @@ package org.traccar.protocol; -import org.traccar.ProtocolTest; - import org.junit.Test; +import org.traccar.ProtocolTest; public class NavisProtocolDecoderTest extends ProtocolTest { diff --git a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java index 4d908b750..6f6298ffa 100644 --- a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java @@ -5,7 +5,10 @@ import org.traccar.ProtocolTest; import org.traccar.database.MediaManager; import org.traccar.model.Position; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class WatchProtocolDecoderTest extends ProtocolTest { diff --git a/src/test/java/org/traccar/reports/ReportUtilsTest.java b/src/test/java/org/traccar/reports/ReportUtilsTest.java index b27104f76..be473a341 100644 --- a/src/test/java/org/traccar/reports/ReportUtilsTest.java +++ b/src/test/java/org/traccar/reports/ReportUtilsTest.java @@ -1,12 +1,13 @@ package org.traccar.reports; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import org.junit.Test; +import org.traccar.BaseTest; +import org.traccar.database.IdentityManager; +import org.traccar.model.Device; +import org.traccar.model.Position; +import org.traccar.reports.model.StopReport; +import org.traccar.reports.model.TripReport; +import org.traccar.reports.model.TripsConfig; import java.text.DateFormat; import java.text.ParseException; @@ -18,14 +19,13 @@ import java.util.Iterator; import java.util.List; import java.util.TimeZone; -import org.junit.Test; -import org.traccar.BaseTest; -import org.traccar.database.IdentityManager; -import org.traccar.model.Device; -import org.traccar.model.Position; -import org.traccar.reports.model.StopReport; -import org.traccar.reports.model.TripReport; -import org.traccar.reports.model.TripsConfig; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class ReportUtilsTest extends BaseTest { |