From 4af79323eff0aa57c44e4069bcb46cb8388c9524 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 19 Apr 2016 11:31:12 +1200 Subject: Improve support for Ulbotech protocol --- test/org/traccar/ProtocolTest.java | 4 ++++ .../protocol/UlbotechProtocolDecoderTest.java | 23 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java index a4dcbf61c..2f5f3962f 100644 --- a/test/org/traccar/ProtocolTest.java +++ b/test/org/traccar/ProtocolTest.java @@ -104,6 +104,10 @@ public class ProtocolTest { return request; } + protected void verifyNotNull(BaseProtocolDecoder decoder, Object object) throws Exception { + Assert.assertNotNull(decoder.decode(null, null, object)); + } + protected void verifyNothing(BaseProtocolDecoder decoder, Object object) throws Exception { Assert.assertNull(decoder.decode(null, null, object)); } diff --git a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java index bf01baa4a..5036c4a40 100644 --- a/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java +++ b/test/org/traccar/protocol/UlbotechProtocolDecoderTest.java @@ -10,8 +10,23 @@ public class UlbotechProtocolDecoderTest extends ProtocolTest { UlbotechProtocolDecoder decoder = new UlbotechProtocolDecoder(new UlbotechProtocol()); - /*verifyPosition(decoder, binary( - "f8010108683230211861161e9d8c48020b00de0063eb730128b56161030400010001040400127d0705060174179422021005e000000001db06f8"));*/ + verifyNotNull(decoder, binary( + "F8010108683230231070781EA3676E020BFFFFFFFFFFFFFFFFFFFF780304000000030404000002C20506032A1790220E100101AC72F8")); + + verifyNotNull(decoder, binary( + "f8010108683230220996561ea6ce1c020bffffffffffffffffffff78030400000000040400087b710506035519ad2214060800000000000000006220f8")); + + verifyAttributes(decoder, binary( + "f8010108683230220996561ea6ce3f020b02cc00114e86000002f153030400000000040400087b710506035619a4221406080000000000000000fbcff8")); + + verifyAttributes(decoder, binary( + "f8010108683230211861161e9d8c48020b00de0063eb730128b56161030400010001040400127d0705060174179422021005e000000001db06f8")); + + verifyPosition(decoder, binary( + "f8010108683230220996561ea6cdf9010eff47465cfb68d7a000000000270f030400000000040400087b710506035119ba22140608000000000000000022cef8")); + + verifyPosition(decoder, binary( + "f8010108683230220996561ea74274010eff47477bfb68d89000000000270f030400000000040400087b710506035419472214060800000000000000006661f8")); verifyPosition(decoder, binary( "f8010103515790566431569e5fbb9d010e015ee2b906bde4a000000000009f03040a4000000404000115fe05060340173f22030711310583410c0000310d00312f834131000008040000b78c09077320290082c021100101120af8")); @@ -43,10 +58,10 @@ public class UlbotechProtocolDecoderTest extends ProtocolTest { verifyPosition(decoder, binary( "F8010108621060211481299C4249FA010E015EE27506BDE80900020000008F030402420000040400523CAF05060392173F220706080000000000000000071131058E410C0E40310D48312F8E41310884080402CA60E43872F8")); - verifyNothing(decoder, binary( + verifyNotNull(decoder, binary( "f8010108653280262660481cdacf830209ffffffffffffffff780304000300000404000000030506017418a021f99697f8")); - verifyNothing(decoder, binary( + verifyNotNull(decoder, binary( "f801010865328026266048fffeae800209ffffffffffffffff7803040200000004040000000005060375175421f3060800000000000000009c28f8")); verifyPosition(decoder, binary( -- cgit v1.2.3