aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/protocol/AdmProtocolDecoderTest.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-22 15:26:17 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-22 15:26:17 +1300
commit1ca95d099df96d576a0eaddc6e42b5b41aed3e06 (patch)
tree65ae84eb5e301317263fd72c31cc54922c71eb96 /test/org/traccar/protocol/AdmProtocolDecoderTest.java
parent122a26d2822f35b27b9cb0b217916d6b821d9654 (diff)
downloadtrackermap-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.tar.gz
trackermap-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.tar.bz2
trackermap-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.zip
Refactor protocol unit testing
Diffstat (limited to 'test/org/traccar/protocol/AdmProtocolDecoderTest.java')
-rw-r--r--test/org/traccar/protocol/AdmProtocolDecoderTest.java30
1 files changed, 13 insertions, 17 deletions
diff --git a/test/org/traccar/protocol/AdmProtocolDecoderTest.java b/test/org/traccar/protocol/AdmProtocolDecoderTest.java
index 3720afbea..125d7bdd8 100644
--- a/test/org/traccar/protocol/AdmProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/AdmProtocolDecoderTest.java
@@ -1,14 +1,10 @@
package org.traccar.protocol;
-import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
-import org.traccar.helper.ChannelBufferTools;
+import org.traccar.ProtocolDecoderTest;
import java.nio.ByteOrder;
-import static org.junit.Assert.assertNull;
-import static org.traccar.helper.DecoderVerifier.verify;
-
public class AdmProtocolDecoderTest extends ProtocolDecoderTest {
@Test
@@ -16,23 +12,23 @@ public class AdmProtocolDecoderTest extends ProtocolDecoderTest {
AdmProtocolDecoder decoder = new AdmProtocolDecoder(new AdmProtocol());
- assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "010042033836313331313030323639343838320501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000073"))));
+ verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "010042033836313331313030323639343838320501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000073"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "010022003300072020000000000000000044062A330000000000107F10565D4A8310"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "010022003300072020000000000000000044062A330000000000107F10565D4A8310"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "0100268033641080207AA34C424CCF8E4239030800005B01140755E30F560000F00F70220000"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "0100268033641080207AA34C424CCF8E4239030800005B01140755E30F560000F00F70220000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01002680336510002062A34C423DCF8E42A50B1700005801140767E30F568F2534107D220000"));
- verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString(
- "01002200333508202000000000000000007F0D9F030000000000E39A1056E24A8210"))));
+ verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "01002200333508202000000000000000007F0D9F030000000000E39A1056E24A8210"));
}