aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-02-14 23:21:09 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-02-14 23:21:09 +1300
commitaac29a8a4452b4977779e2ceb7285c17c6369691 (patch)
treea9e9461273a7f2ae93e85affdce1e7cf3f289c6d
parent82965326887d0867f8edf29e638630c2ee85423c (diff)
downloadtraccar-server-aac29a8a4452b4977779e2ceb7285c17c6369691.tar.gz
traccar-server-aac29a8a4452b4977779e2ceb7285c17c6369691.tar.bz2
traccar-server-aac29a8a4452b4977779e2ceb7285c17c6369691.zip
Add TLT-2H unit test
-rw-r--r--src/org/traccar/protocol/Tlt2hProtocolDecoder.java2
-rw-r--r--test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
index 60f624dd6..531ae28b6 100644
--- a/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
+++ b/src/org/traccar/protocol/Tlt2hProtocolDecoder.java
@@ -60,7 +60,7 @@ public class Tlt2hProtocolDecoder extends BaseProtocolDecoder {
// Get device identifier
String imei = sentence.substring(1, sentence.indexOf('#', 1));
- long deviceId = 0;
+ long deviceId;
try {
deviceId = getDataManager().getDeviceByImei(imei).getId();
} catch(Exception error) {
diff --git a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
index 9c2324be7..8660e733c 100644
--- a/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Tlt2hProtocolDecoderTest.java
@@ -10,6 +10,10 @@ public class Tlt2hProtocolDecoderTest {
Tlt2hProtocolDecoder decoder = new Tlt2hProtocolDecoder(null);
decoder.setDataManager(new TestDataManager());
+
+ assertNotNull(decoder.decode(null, null,
+ "#357671030938911#V500#0000#AUTOSTOP#1\r\n" +
+ "#00b34d3c$GPRMC,140026.000,A,2623.6452,S,02828.8990,E,0.00,65.44,130213,,,A*4B\r\n"));
assertNotNull(decoder.decode(null, null,
"#123456789000001#V3338#0000#SMS#3\r\n" +