diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-15 14:07:39 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-15 14:07:39 +1300 |
commit | cfe237cf26c6309b8431b3b81d589628ae363804 (patch) | |
tree | 64aa120e80bb91e1e8de3995b6dd1494a8962217 /test/org/traccar/ProtocolDecoderTest.java | |
parent | f9f37325f1161ddc2b726171e8af0dbb25787c6e (diff) | |
download | trackermap-server-cfe237cf26c6309b8431b3b81d589628ae363804.tar.gz trackermap-server-cfe237cf26c6309b8431b3b81d589628ae363804.tar.bz2 trackermap-server-cfe237cf26c6309b8431b3b81d589628ae363804.zip |
Rename cell attribute to cid
Diffstat (limited to 'test/org/traccar/ProtocolDecoderTest.java')
-rw-r--r-- | test/org/traccar/ProtocolDecoderTest.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/org/traccar/ProtocolDecoderTest.java b/test/org/traccar/ProtocolDecoderTest.java index a142f2d4d..2906f2002 100644 --- a/test/org/traccar/ProtocolDecoderTest.java +++ b/test/org/traccar/ProtocolDecoderTest.java @@ -8,6 +8,7 @@ import org.jboss.netty.handler.codec.http.HttpVersion; import org.junit.Assert; import org.traccar.database.IdentityManager; import org.traccar.model.Device; +import org.traccar.model.Event; import org.traccar.model.Position; import javax.xml.bind.DatatypeConverter; @@ -18,6 +19,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.Map; import java.util.TimeZone; public class ProtocolDecoderTest { @@ -179,12 +181,27 @@ public class ProtocolDecoderTest { } + Map<String, Object> attributes = position.getAttributes(); + if (checkAttributes) { + Assert.assertFalse("no attributes", attributes.isEmpty()); + } - Assert.assertFalse("no attributes", position.getAttributes().isEmpty()); + /*if (attributes.containsKey(Event.KEY_LAC) || attributes.containsKey(Event.KEY_CID)) { + checkInteger(attributes.get(Event.KEY_MCC), 100, 999); + checkInteger(attributes.get(Event.KEY_MNC), 0, 999); + checkInteger(attributes.get(Event.KEY_LAC), 1, 65535); + checkInteger(attributes.get(Event.KEY_CID), 1, 65535); + }*/ - } + } + private void checkInteger(Object value, int min, int max) { + Assert.assertNotNull("value is null", value); + Assert.assertTrue("not int or long", value instanceof Integer || value instanceof Long); + long number = ((Number) value).longValue(); + Assert.assertTrue("value too low", number >= min); + Assert.assertTrue("value too high", number <= max); } } |