diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-22 15:26:17 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-22 15:26:17 +1300 |
commit | 1ca95d099df96d576a0eaddc6e42b5b41aed3e06 (patch) | |
tree | 65ae84eb5e301317263fd72c31cc54922c71eb96 /test/org/traccar/protocol/NoranProtocolDecoderTest.java | |
parent | 122a26d2822f35b27b9cb0b217916d6b821d9654 (diff) | |
download | trackermap-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.tar.gz trackermap-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.tar.bz2 trackermap-server-1ca95d099df96d576a0eaddc6e42b5b41aed3e06.zip |
Refactor protocol unit testing
Diffstat (limited to 'test/org/traccar/protocol/NoranProtocolDecoderTest.java')
-rw-r--r-- | test/org/traccar/protocol/NoranProtocolDecoderTest.java | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/test/org/traccar/protocol/NoranProtocolDecoderTest.java b/test/org/traccar/protocol/NoranProtocolDecoderTest.java index a320e4c49..b3e454f6a 100644 --- a/test/org/traccar/protocol/NoranProtocolDecoderTest.java +++ b/test/org/traccar/protocol/NoranProtocolDecoderTest.java @@ -2,10 +2,9 @@ package org.traccar.protocol; import java.nio.ByteOrder; import org.jboss.netty.buffer.ChannelBuffers; -import static org.junit.Assert.assertNull; import org.junit.Test; +import org.traccar.ProtocolDecoderTest; import org.traccar.helper.ChannelBufferTools; -import static org.traccar.helper.DecoderVerifier.verify; public class NoranProtocolDecoderTest extends ProtocolDecoderTest { @@ -14,26 +13,26 @@ public class NoranProtocolDecoderTest extends ProtocolDecoderTest { NoranProtocolDecoder decoder = new NoranProtocolDecoder(new NoranProtocol()); - //verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( - // "28003200c38000d900fcc97a416b1a7a42b43eef3d4e523039473034383737000000000092fcda4a")))); + //verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + // "28003200c38000d900fcc97a416b1a7a42b43eef3d4e523039473034383737000000000092fcda4a")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( - "3400080001090000000000001D43A29BE842E62520424E523039423036363932000031322D30332D30352031313A34373A343300")))); + verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "3400080001090000000000001D43A29BE842E62520424E523039423036363932000031322D30332D30352031313A34373A343300")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( - "34000800010c000000000080a3438e20944149bd07c24e523039423139323832000031352d30342d32362030383a34333a353300")))); + verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "34000800010c000000000080a3438e20944149bd07c24e523039423139323832000031352d30342d32362030383a34333a353300")); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( - "0f0000004e52303946303431353500")))); + verifyNothing(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "0f0000004e52303946303431353500")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( - "22000800010c008a007e9daa42317bdd41a7f3e2384e523039463034313535000000")))); + verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "22000800010c008a007e9daa42317bdd41a7f3e2384e523039463034313535000000")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( - "34000800010c0000000000001c4291251143388d17c24e523039423131303930000031342d31322d32352030303a33333a303700")))); + verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "34000800010c0000000000001c4291251143388d17c24e523039423131303930000031342d31322d32352030303a33333a303700")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, ChannelBufferTools.convertHexString( - "34000800010c00000000000000006520944141bd07c24e523039423139323832000031352d30342d32352030303a30333a323200")))); + verifyPosition(decoder, binary(ByteOrder.LITTLE_ENDIAN, + "34000800010c00000000000000006520944141bd07c24e523039423139323832000031352d30342d32352030303a30333a323200")); } |