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/CityeasyProtocolDecoderTest.java | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'test/org/traccar/protocol/CityeasyProtocolDecoderTest.java') diff --git a/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java b/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java index 487d20d4e..33ee51c4f 100644 --- a/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java +++ b/test/org/traccar/protocol/CityeasyProtocolDecoderTest.java @@ -2,10 +2,9 @@ package org.traccar.protocol; import org.jboss.netty.buffer.ChannelBuffers; import org.junit.Test; +import org.traccar.ProtocolDecoderTest; import org.traccar.helper.ChannelBufferTools; -import static org.junit.Assert.assertNull; -import static org.traccar.helper.DecoderVerifier.verify; public class CityeasyProtocolDecoderTest extends ProtocolDecoderTest { @@ -14,20 +13,20 @@ public class CityeasyProtocolDecoderTest extends ProtocolDecoderTest { CityeasyProtocolDecoder decoder = new CityeasyProtocolDecoder(new CityeasyProtocol()); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "545400153520000000000100010000000111000D0A")))); + verifyNothing(decoder, binary( + "545400153520000000000100010000000111000D0A")); - assertNull(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "54540019357557024902000002520704300000000376390d0a")))); + verifyNothing(decoder, binary( + "54540019357557024902000002520704300000000376390d0a")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "5454006135200000000001000332303134313131303039353430392C412C342C4E2C32322E3533373232382C452C3131342E3032323737342C302E312C312E392C35302E363B3436302C302C31303137332C343635322C34310000000B63130D0A")))); + verifyPosition(decoder, binary( + "5454006135200000000001000332303134313131303039353430392C412C342C4E2C32322E3533373232382C452C3131342E3032323737342C302E312C312E392C35302E363B3436302C302C31303137332C343635322C34310000000B63130D0A")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "5454006135200000000001000432303134313131303039353330362C412C352C4E2C32322E3533373233352C452C3131342E3032323838312C302E322C312E362C35342E313B3436302C302C31303137332C343635322C343100000045EC620D0A")))); + verifyPosition(decoder, binary( + "5454006135200000000001000432303134313131303039353330362C412C352C4E2C32322E3533373233352C452C3131342E3032323838312C302E322C312E362C35342E313B3436302C302C31303137332C343635322C343100000045EC620D0A")); - verify(decoder.decode(null, null, ChannelBuffers.wrappedBuffer(ChannelBufferTools.convertHexString( - "5454009035755702490200000332303135303732393033303834352c412c362c4e2c31322e3833353735362c452c37372e3638373039362c302e332c312e322c3931302e303b3430342c34352c31303638312c31313632312c34332c31303638312c31313632332c32312c31303638312c32323538332c32302c31303638312c32333338312c31380000000267370d0a")))); + verifyPosition(decoder, binary( + "5454009035755702490200000332303135303732393033303834352c412c362c4e2c31322e3833353735362c452c37372e3638373039362c302e332c312e322c3931302e303b3430342c34352c31303638312c31313632312c34332c31303638312c31313632332c32312c31303638312c32323538332c32302c31303638312c32333338312c31380000000267370d0a")); } -- cgit v1.2.3