diff options
author | Christoph Krey <c@ckrey.de> | 2018-04-16 10:45:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-16 10:45:11 +0200 |
commit | 3a602dd133b533cc69d5986d64a00fb3ed670f75 (patch) | |
tree | 97ff753db310a49ae7e53240b1db07fb8475679e /test/org/traccar/processing/ComputedAttributesTest.java | |
parent | 232de5f0daef98f31b28d177d991fdbfa191f195 (diff) | |
parent | 6d4b8df25c7e942b9ad594db9444fe15bcb16be9 (diff) | |
download | traccar-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.tar.gz traccar-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.tar.bz2 traccar-server-3a602dd133b533cc69d5986d64a00fb3ed670f75.zip |
Merge pull request #4 from traccar/master
upgrade to current master
Diffstat (limited to 'test/org/traccar/processing/ComputedAttributesTest.java')
-rw-r--r-- | test/org/traccar/processing/ComputedAttributesTest.java | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/test/org/traccar/processing/ComputedAttributesTest.java b/test/org/traccar/processing/ComputedAttributesTest.java index fe898ff54..160067915 100644 --- a/test/org/traccar/processing/ComputedAttributesTest.java +++ b/test/org/traccar/processing/ComputedAttributesTest.java @@ -2,11 +2,12 @@ package org.traccar.processing; import java.util.Date; -import org.junit.Assert; import org.junit.Test; import org.traccar.model.Attribute; import org.traccar.model.Position; +import static org.junit.Assert.assertEquals; + public class ComputedAttributesTest { @Test @@ -26,41 +27,41 @@ public class ComputedAttributesTest { Attribute attribute = new Attribute(); attribute.setExpression("adc1"); - Assert.assertEquals(128, computedAttributesHandler.computeAttribute(attribute, position)); + assertEquals(128, computedAttributesHandler.computeAttribute(attribute, position)); attribute.setExpression("!booleanFlag"); - Assert.assertEquals(false, computedAttributesHandler.computeAttribute(attribute, position)); + assertEquals(false, computedAttributesHandler.computeAttribute(attribute, position)); attribute.setExpression("adc2 * 2 + 50"); - Assert.assertEquals(250, computedAttributesHandler.computeAttribute(attribute, position)); + assertEquals(250, computedAttributesHandler.computeAttribute(attribute, position)); attribute.setExpression("(bitFlag & 4) != 0"); - Assert.assertEquals(true, computedAttributesHandler.computeAttribute(attribute, position)); + assertEquals(true, computedAttributesHandler.computeAttribute(attribute, position)); attribute.setExpression("if (event == 42) \"lowBattery\""); - Assert.assertEquals("lowBattery", computedAttributesHandler.computeAttribute(attribute, position)); + assertEquals("lowBattery", computedAttributesHandler.computeAttribute(attribute, position)); attribute.setExpression("speed > 5 && valid"); - Assert.assertEquals(false, computedAttributesHandler.computeAttribute(attribute, position)); + assertEquals(false, computedAttributesHandler.computeAttribute(attribute, position)); attribute.setExpression("fixTime"); - Assert.assertEquals(date, computedAttributesHandler.computeAttribute(attribute, position)); + assertEquals(date, computedAttributesHandler.computeAttribute(attribute, position)); attribute.setExpression("math:pow(adc1, 2)"); - Assert.assertEquals(16384.0, computedAttributesHandler.computeAttribute(attribute, position)); + assertEquals(16384.0, computedAttributesHandler.computeAttribute(attribute, position)); // modification tests attribute.setExpression("adc1 = 256"); computedAttributesHandler.computeAttribute(attribute, position); - Assert.assertEquals(128, position.getInteger("adc1")); + assertEquals(128, position.getInteger("adc1")); attribute.setExpression("result = \"fail\""); computedAttributesHandler.computeAttribute(attribute, position); - Assert.assertEquals("success", position.getString("result")); + assertEquals("success", position.getString("result")); attribute.setExpression("fixTime = \"2017-10-18 10:00:01\""); computedAttributesHandler.computeAttribute(attribute, position); - Assert.assertEquals(date, position.getFixTime()); + assertEquals(date, position.getFixTime()); } |