aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-02-19 11:53:08 -0800
committerAnton Tananaev <anton@traccar.org>2024-02-19 11:53:14 -0800
commitefd9e261791942334dbf4a911883a1b2b791f282 (patch)
tree8aa830282cd64b9b3a28e858865a8783b1eea3bc /src/test
parent26548bb534de6c9944ece5a2aa5216da83cb8819 (diff)
downloadtrackermap-server-efd9e261791942334dbf4a911883a1b2b791f282.tar.gz
trackermap-server-efd9e261791942334dbf4a911883a1b2b791f282.tar.bz2
trackermap-server-efd9e261791942334dbf4a911883a1b2b791f282.zip
Streamline model name access
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/traccar/BaseTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java3
-rw-r--r--src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java3
3 files changed, 4 insertions, 5 deletions
diff --git a/src/test/java/org/traccar/BaseTest.java b/src/test/java/org/traccar/BaseTest.java
index 2ace781f3..ce19d8ace 100644
--- a/src/test/java/org/traccar/BaseTest.java
+++ b/src/test/java/org/traccar/BaseTest.java
@@ -33,7 +33,8 @@ public class BaseTest {
var connectionManager = mock(ConnectionManager.class);
var uniqueIdsProvided = new HashSet<Boolean>();
when(connectionManager.getDeviceSession(any(), any(), any(), any(String[].class))).thenAnswer(invocation -> {
- var mock = new DeviceSession(1L, "", mock(Protocol.class), mock(Channel.class), mock(SocketAddress.class));
+ var mock = new DeviceSession(
+ 1L, "", null, mock(Protocol.class), mock(Channel.class), mock(SocketAddress.class));
if (uniqueIdsProvided.isEmpty()) {
if (invocation.getArguments().length > 3) {
uniqueIdsProvided.add(true);
diff --git a/src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java b/src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java
index ef6ff6dd9..32c8a9ce6 100644
--- a/src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java
+++ b/src/test/java/org/traccar/protocol/Minifinder2ProtocolEncoderTest.java
@@ -14,8 +14,7 @@ public class Minifinder2ProtocolEncoderTest extends ProtocolTest {
var encoder = inject(new Minifinder2ProtocolEncoder(null));
- var device = encoder.getCacheManager().getObject(Device.class, 1);
- when(device.getModel()).thenReturn("Nano");
+ encoder.setModelOverride("Nano");
Command command = new Command();
command.setDeviceId(1);
diff --git a/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
index 8a275ce9a..c7d0671c0 100644
--- a/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/SigfoxProtocolDecoderTest.java
@@ -46,8 +46,7 @@ public class SigfoxProtocolDecoderTest extends ProtocolTest {
verifyPosition(decoder, request(HttpMethod.POST, "/",
buffer("%7B++%22device%22%3A%222BF839%22%2C++%22time%22%3A1510605882%2C++%22duplicate%22%3Afalse%2C++%22snr%22%3A45.61%2C++%22station%22%3A%2235A9%22%2C++%22data%22%3A%2200bd6475e907398e562d01b9%22%2C++%22avgSnr%22%3A45.16%2C++%22lat%22%3A-38.0%2C++%22lng%22%3A145.0%2C++%22rssi%22%3A-98.00%2C++%22seqNumber%22%3A228+%7D=")));
- var device = decoder.getCacheManager().getObject(Device.class, 1);
- when(device.getModel()).thenReturn("Amber");
+ decoder.setModelOverride("Amber");
verifyPosition(decoder, request(HttpMethod.POST, "/",
buffer("{ \"deviceId\":\"284019F\", \"timestamp\":\"1707375610\", \"seqNo\":\"42\", \"data\":\"0100b019ffe8645d0019e513\", \"linkQuality\":\"Excellent\", \"operator\":\"SIGFOX_South_Africa_Sqwidnet\", \"country\":\"710\" }")));