diff options
Diffstat (limited to 'test/org')
-rw-r--r-- | test/org/traccar/ProtocolTest.java | 4 | ||||
-rw-r--r-- | test/org/traccar/processing/PopulateDriverTest.java | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/org/traccar/ProtocolTest.java b/test/org/traccar/ProtocolTest.java index 3b801c6eb..dc4f70981 100644 --- a/test/org/traccar/ProtocolTest.java +++ b/test/org/traccar/ProtocolTest.java @@ -245,6 +245,10 @@ public class ProtocolTest extends BaseTest { Assert.assertTrue(attributes.get(Position.KEY_ARCHIVE) instanceof Boolean); } + if (attributes.containsKey(Position.KEY_RFID)) { + Assert.assertTrue(attributes.get(Position.KEY_RFID) instanceof String); + } + if (position.getNetwork() != null && position.getNetwork().getCellTowers() != null) { for (CellTower cellTower : position.getNetwork().getCellTowers()) { checkInteger(cellTower.getMobileCountryCode(), 0, 999); diff --git a/test/org/traccar/processing/PopulateDriverTest.java b/test/org/traccar/processing/PopulateDriverTest.java new file mode 100644 index 000000000..7c6ee9f06 --- /dev/null +++ b/test/org/traccar/processing/PopulateDriverTest.java @@ -0,0 +1,21 @@ +package org.traccar.processing; + +import org.junit.Assert; +import org.junit.Test; +import org.traccar.model.Position; + +public class PopulateDriverTest { + + @Test + public void testPopulateDriver() { + Position position = new Position(); + PopulateDriverHandler populateDriverHandler = new PopulateDriverHandler(); + Assert.assertNull(populateDriverHandler.handlePosition(position).getString(Position.KEY_DRIVER_UNIQUE_ID)); + position.set(Position.KEY_DRIVER_UNIQUE_ID, "123"); + Assert.assertEquals("123", + populateDriverHandler.handlePosition(position).getString(Position.KEY_DRIVER_UNIQUE_ID)); + position.set(Position.KEY_RFID, "321"); + Assert.assertEquals("321", + populateDriverHandler.handlePosition(position).getString(Position.KEY_DRIVER_UNIQUE_ID)); + } +} |