@Test public void test_OPAL_1110() { JavascriptValueSource source = new JavascriptValueSource(TextType.get(), "1"); source.initialise(); Value value = source.getValue(mockValueSet); assertThat(value.getValue()).isEqualTo("1"); }
@Test public void test_simple_script() { JavascriptValueSource source = new JavascriptValueSource(DecimalType.get(), "1"); source.initialise(); Value value = source.getValue(mockValueSet); assertThat(value.getValue()).isEqualTo(1d); }
@Test public void test_engine_method() { JavascriptValueSource source = new JavascriptValueSource(DateTimeType.get(), "now()"); source.initialise(); Value value = source.getValue(mockValueSet); assertThat(value).isNotNull(); assertThat(value.isNull()).isFalse(); assertThat(value.getValueType()).isEqualTo(DateTimeType.get()); Date dateValue = (Date) value.getValue(); // Make sure both dates are within 1 second of one-another assertThat(System.currentTimeMillis() - dateValue.getTime()).isLessThan(1000); }