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/LaipacProtocolDecoderTest.java | 55 +++++++++++----------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'test/org/traccar/protocol/LaipacProtocolDecoderTest.java') diff --git a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java index 62ca2fc1c..1c5c05476 100644 --- a/test/org/traccar/protocol/LaipacProtocolDecoderTest.java +++ b/test/org/traccar/protocol/LaipacProtocolDecoderTest.java @@ -1,8 +1,7 @@ package org.traccar.protocol; -import static org.traccar.helper.DecoderVerifier.verify; -import static org.junit.Assert.assertNull; import org.junit.Test; +import org.traccar.ProtocolDecoderTest; public class LaipacProtocolDecoderTest extends ProtocolDecoderTest { @@ -11,77 +10,77 @@ public class LaipacProtocolDecoderTest extends ProtocolDecoderTest { LaipacProtocolDecoder decoder = new LaipacProtocolDecoder(new LaipacProtocol()); - assertNull(decoder.decode(null, null, "$AVSYS,99999999,V1.50,SN0000103,32768*15")); + verifyNothing(decoder, text( "$AVSYS,99999999,V1.50,SN0000103,32768*15")); - assertNull(decoder.decode(null, null, "$ECHK,99999999,0*35")); + verifyNothing(decoder, text( "$ECHK,99999999,0*35")); - assertNull(decoder.decode(null, null, "$AVSYS,MSG00002,14406,7046811160,64*1A")); + verifyNothing(decoder, text( "$AVSYS,MSG00002,14406,7046811160,64*1A")); - assertNull(decoder.decode(null, null, "$EAVSYS,MSG00002,8931086013104404999,,Owner,0x52014406*76")); + verifyNothing(decoder, text( "$EAVSYS,MSG00002,8931086013104404999,,Owner,0x52014406*76")); - assertNull(decoder.decode(null, null, "$ECHK,MSG00002,0*5E")); + verifyNothing(decoder, text( "$ECHK,MSG00002,0*5E")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*37")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,a,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*17")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,v,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*00")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,r,4351.0542,N,07923.5445,W,0.29,78.66,180703,0,3.727,17,1,0,0*04")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,S,3.727,17,1,0,0*54")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,T,3.727,17,1,0,0*53")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,3,3.727,17,1,0,0*34")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,X,3.727,17,1,0,0*5F")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,99999999,164339,A,4351.0542,N,07923.5445,W,0.29,78.66,180703,4,3.727,17,1,0,0*33")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,003016,v,0000.0000,N,00000.0000,E,0.00,0.00,200614,0,3804,167,1,0,0,0D7AB913,020408*23")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,003049,V,0000.0000,N,00000.0000,E,0.00,0.00,200614,H,3804,167,1,0,0,0D7AB913,020408*71")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,041942,V,0000.0000,N,00000.0000,E,0.00,0.00,200614,H,4115,167,1,0,0*0E")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,043703,V,0000.0000,N,00000.0000,E,0.00,0.00,200614,H,4115,167,1,0,0*07")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,043750,V,0000.0000,N,00000.0000,E,0.00,0.00,200614,H,4115,167,1,0,0*01")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,124022,V,0000.0000,N,00000.0000,E,0.00,0.00,240614,3,4076,167,1,0,0,0D7AB913,020408*0D")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,124058,A,5053.0447,N,00557.8549,E,0.45,65.06,240614,0,4037,167,1,0,0,0D7AB913,020408*26")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,124144,A,5053.0450,N,00557.8544,E,0.00,65.06,240614,3,4076,167,1,0,0,0D7AB913,020408*26")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,125142,R,5053.0442,N,00557.8694,E,1.21,40.90,240614,0,4037,167,1,0,0,0D7AB913,020408*33")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,125517,R,5053.0442,N,00557.8694,E,0.00,0.00,240614,H,4076,167,1,0,0,0D7AB913,020408*75")); - /*verify(decoder.decode(null, null, + /*verifyPosition(decoder, text( "$AVRMC,MSG00002,043104,p,5114.4664,N,00534.3308,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*52")); - verify(decoder.decode(null, null, + verifyPosition(decoder, text( "$AVRMC,MSG00002,050601,P,5114.4751,N,00534.3175,E,0.00,0.00,280614,0,4115,495,1,0,0,0D48C3DC,020408*7D"));*/ } -- cgit v1.2.3