From 44f026f881efa6207ab79fb5bada20ab67f018a0 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 27 Apr 2016 11:21:27 +1200 Subject: Rename ChannelBufferTools to BcdUtil --- test/org/traccar/helper/BcdUtilTest.java | 25 ++++++++++++++++++++++ .../org/traccar/helper/ChannelBufferToolsTest.java | 25 ---------------------- 2 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 test/org/traccar/helper/BcdUtilTest.java delete mode 100644 test/org/traccar/helper/ChannelBufferToolsTest.java (limited to 'test/org/traccar/helper') diff --git a/test/org/traccar/helper/BcdUtilTest.java b/test/org/traccar/helper/BcdUtilTest.java new file mode 100644 index 000000000..8767ac890 --- /dev/null +++ b/test/org/traccar/helper/BcdUtilTest.java @@ -0,0 +1,25 @@ +package org.traccar.helper; + +import org.jboss.netty.buffer.ChannelBuffers; +import org.junit.Assert; +import org.junit.Test; + +public class BcdUtilTest { + + @Test + public void testReadInteger() { + byte[] buf = {0x01, (byte) 0x90, 0x34}; + int result = BcdUtil.readInteger( + ChannelBuffers.wrappedBuffer(buf), 5); + Assert.assertEquals(1903, result); + } + + @Test + public void testReadCoordinate() { + byte[] buf = {0x03, (byte) 0x85, 0x22, 0x59, 0x34}; + double result = BcdUtil.readCoordinate( + ChannelBuffers.wrappedBuffer(buf)); + Assert.assertEquals(38.870989, result, 0.00001); + } + +} diff --git a/test/org/traccar/helper/ChannelBufferToolsTest.java b/test/org/traccar/helper/ChannelBufferToolsTest.java deleted file mode 100644 index 6733a8f2a..000000000 --- a/test/org/traccar/helper/ChannelBufferToolsTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.traccar.helper; - -import org.jboss.netty.buffer.ChannelBuffers; -import org.junit.Assert; -import org.junit.Test; - -public class ChannelBufferToolsTest { - - @Test - public void testReadHexInteger() { - byte[] buf = {0x01, (byte) 0x90, 0x34}; - int result = ChannelBufferTools.readHexInteger( - ChannelBuffers.wrappedBuffer(buf), 5); - Assert.assertEquals(1903, result); - } - - @Test - public void testReadCoordinate() { - byte[] buf = {0x03, (byte) 0x85, 0x22, 0x59, 0x34}; - double result = ChannelBufferTools.readCoordinate( - ChannelBuffers.wrappedBuffer(buf)); - Assert.assertEquals(38.870989, result, 0.00001); - } - -} -- cgit v1.2.3