From 5fa04496f7f752e6c7fe339b712875ae6b860d3d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 3 Oct 2016 04:57:44 +1300 Subject: Add cell info class --- test/org/traccar/location/CellInfoTest.java | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/org/traccar/location/CellInfoTest.java (limited to 'test') diff --git a/test/org/traccar/location/CellInfoTest.java b/test/org/traccar/location/CellInfoTest.java new file mode 100644 index 000000000..e78ce51fb --- /dev/null +++ b/test/org/traccar/location/CellInfoTest.java @@ -0,0 +1,36 @@ +package org.traccar.location; + +import org.junit.Assert; +import org.junit.Test; + +public class CellInfoTest { + + @Test + public void testToString() { + + CellInfo info = new CellInfo(); + info.addCell(0, 0, 1000, 2000); + info.addCell(400, 1, 3000, 4000); + + Assert.assertEquals("[{\"lac\":1000,\"cid\":2000},{\"mcc\":400,\"mnc\":1,\"lac\":3000,\"cid\":4000}]", info.toString()); + + } + + @Test + public void testFromString() { + + CellInfo info = CellInfo.fromString("[{\"lac\":1000,\"cid\":2000}]"); + + Assert.assertEquals(1, info.getCells().size()); + + CellInfo.Cell cell = info.getCells().get(0); + + Assert.assertEquals(0, cell.getMcc()); + Assert.assertEquals(0, cell.getMnc()); + Assert.assertEquals(1000, cell.getLac()); + Assert.assertEquals(2000, cell.getCid()); + Assert.assertEquals(0, cell.getSignal()); + + } + +} -- cgit v1.2.3