diff options
Diffstat (limited to 'test/org/traccar/processing/ComputedAttributesTest.java')
-rw-r--r-- | test/org/traccar/processing/ComputedAttributesTest.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/test/org/traccar/processing/ComputedAttributesTest.java b/test/org/traccar/processing/ComputedAttributesTest.java index fe898ff54..88ebfd9a9 100644 --- a/test/org/traccar/processing/ComputedAttributesTest.java +++ b/test/org/traccar/processing/ComputedAttributesTest.java @@ -7,6 +7,8 @@ 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 +28,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()); } |