From 1ca95d099df96d576a0eaddc6e42b5b41aed3e06 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 22 Oct 2015 15:26:17 +1300 Subject: Refactor protocol unit testing --- .../traccar/protocol/KhdProtocolDecoderTest.java | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'test/org/traccar/protocol/KhdProtocolDecoderTest.java') diff --git a/test/org/traccar/protocol/KhdProtocolDecoderTest.java b/test/org/traccar/protocol/KhdProtocolDecoderTest.java index 7f9eb4a7a..ec013f619 100644 --- a/test/org/traccar/protocol/KhdProtocolDecoderTest.java +++ b/test/org/traccar/protocol/KhdProtocolDecoderTest.java @@ -1,9 +1,9 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffers; -import static org.traccar.helper.DecoderVerifier.verify; -import static org.junit.Assert.assertNull; + import org.junit.Test; +import org.traccar.ProtocolDecoderTest; import org.traccar.helper.ChannelBufferTools; public class KhdProtocolDecoderTest extends ProtocolDecoderTest { @@ -13,32 +13,32 @@ public class KhdProtocolDecoderTest extends ProtocolDecoderTest { KhdProtocolDecoder decoder = new KhdProtocolDecoder(new KhdProtocol()); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "2929b1000605162935b80d")))); + verifyNothing(decoder, binary( + "2929b1000605162935b80d")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "292980002805162935140108074727801129670365336900000103ffff000082fc0000001e78091b000000360d")))); + verifyPosition(decoder, binary( + "292980002805162935140108074727801129670365336900000103ffff000082fc0000001e78091b000000360d")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "29298100280A9F9538081228160131022394301140372500000330FF0000007FFC0F00001E000000000034290D")))); + verifyPosition(decoder, binary( + "29298100280A9F9538081228160131022394301140372500000330FF0000007FFC0F00001E000000000034290D")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "29298000280A81850A120310095750005281370061190800000232F848FFBBFFFF0000001E000000000000ED0D")))); + verifyPosition(decoder, binary( + "29298000280A81850A120310095750005281370061190800000232F848FFBBFFFF0000001E000000000000ED0D")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "29298E00280F80815A121218203116022318461140227000720262FB00077C7FBF5600001E3C3200000000850D")))); + verifyPosition(decoder, binary( + "29298E00280F80815A121218203116022318461140227000720262FB00077C7FBF5600001E3C3200000000850D")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "29298200230AA2CC391205030505220285947903109550008002078400000002000000000000750D")))); + verifyPosition(decoder, binary( + "29298200230AA2CC391205030505220285947903109550008002078400000002000000000000750D")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "29298500081DD08C22120312174026026545710312541700000000F819C839FFFF1D00001E00500000003AF90D")))); + verifyPosition(decoder, binary( + "29298500081DD08C22120312174026026545710312541700000000F819C839FFFF1D00001E00500000003AF90D")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "292980002822836665140825142037045343770193879200000050ffff000082fc000004b0780b170000002a0d")))); + verifyPosition(decoder, binary( + "292980002822836665140825142037045343770193879200000050ffff000082fc000004b0780b170000002a0d")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "292980002802425349120811032137022373011140211100000334FFFF000082FC0000001E780913000034DF0D")))); + verifyPosition(decoder, binary( + "292980002802425349120811032137022373011140211100000334FFFF000082FC0000001E780913000034DF0D")); } -- cgit v1.2.3