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 --- .../protocol/EnforaProtocolDecoderTest.java | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'test/org/traccar/protocol/EnforaProtocolDecoderTest.java') diff --git a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java index 2dd649cbd..ac5191b62 100644 --- a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java +++ b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java @@ -2,10 +2,9 @@ package org.traccar.protocol; 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 EnforaProtocolDecoderTest extends ProtocolDecoderTest { @@ -14,20 +13,20 @@ public class EnforaProtocolDecoderTest extends ProtocolDecoderTest { EnforaProtocolDecoder decoder = new EnforaProtocolDecoder(new EnforaProtocol()); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "000A08002020202020303131303730303030353730323637")))); + verifyNothing(decoder, binary( + "000A08002020202020303131303730303030353730323637")); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "003B000502000000000820202020202030313130373030303035373032363720383A000000000D00508401358E640032B37700000367B00000A804")))); + verifyNothing(decoder, binary( + "003B000502000000000820202020202030313130373030303035373032363720383A000000000D00508401358E640032B37700000367B00000A804")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "007100040200202020202020202020382020202020202031323334353637383930313233343520313320244750524D432C3232333135322E30302C412C333530392E3836303539342C4E2C30333332322E3734333838372C452C302E302C302E302C3032303631322C2C2C412A35320D0A")))); + verifyPosition(decoder, binary( + "007100040200202020202020202020382020202020202031323334353637383930313233343520313320244750524D432C3232333135322E30302C412C333530392E3836303539342C4E2C30333332322E3734333838372C452C302E302C302E302C3032303631322C2C2C412A35320D0A")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "007600040200202020202020202020382020202020202030313138393230303036303831383920313320244750524D432C3137313834312E30302C412C333530392E3835323431302C4E2C30333332322E3735393131332C452C302E302C302E302C3137303731322C332E342C572C412A32350D0A00")))); + verifyPosition(decoder, binary( + "007600040200202020202020202020382020202020202030313138393230303036303831383920313320244750524D432C3137313834312E30302C412C333530392E3835323431302C4E2C30333332322E3735393131332C452C302E302C302E302C3137303731322C332E342C572C412A32350D0A00")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "006a000a081000202020202020202020333320202020202038363130373430323137313936353620204750524d432c3136313234382e30302c412c333433322e36393231312c532c30353833312e30323231372c572c302e3034382c2c3232303831342c2c2c412a3734")))); + verifyPosition(decoder, binary( + "006a000a081000202020202020202020333320202020202038363130373430323137313936353620204750524d432c3136313234382e30302c412c333433322e36393231312c532c30353833312e30323231372c572c302e3034382c2c3232303831342c2c2c412a3734")); } -- cgit v1.2.3