Browse Source

fixed test where rolling arg is NaN

pull/12715/head
IrynaMatveieva 1 year ago
parent
commit
300650ceb6
  1. 2
      application/src/test/java/org/thingsboard/server/service/cf/ctx/state/ScriptCalculatedFieldStateTest.java
  2. 5
      application/src/test/java/org/thingsboard/server/service/cf/ctx/state/TsRollingArgumentEntryTest.java

2
application/src/test/java/org/thingsboard/server/service/cf/ctx/state/ScriptCalculatedFieldStateTest.java

@ -151,7 +151,7 @@ public class ScriptCalculatedFieldStateTest {
}
private TsRollingArgumentEntry createRollingArgEntry() {
TsRollingArgumentEntry argumentEntry = new TsRollingArgumentEntry();
TsRollingArgumentEntry argumentEntry = new TsRollingArgumentEntry(5, 30000L);
long ts = System.currentTimeMillis();
TreeMap<Long, Double> values = new TreeMap<>();

5
application/src/test/java/org/thingsboard/server/service/cf/ctx/state/TsRollingArgumentEntryTest.java

@ -79,9 +79,8 @@ public class TsRollingArgumentEntryTest {
void testUpdateEntryWhenValueIsNotNumber() {
SingleValueArgumentEntry newEntry = new SingleValueArgumentEntry(ts - 10, new StringDataEntry("key", "string"), 123L);
assertThatThrownBy(() -> entry.updateEntry(newEntry))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Time series rolling arguments supports only numeric values.");
assertThat(entry.updateEntry(newEntry)).isTrue();
assertThat(entry.getTsRecords().get(ts - 10)).isNaN();
}
@Test

Loading…
Cancel
Save