Search in sources :

Example 11 with DmnDataTypeTransformer

use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.

the class DmnDataTypeTransformerTest method invalidIntegerMinValueForIntegerType.

@Test
public void invalidIntegerMinValueForIntegerType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("integer");
    thrown.expect(IllegalArgumentException.class);
    typeTransformer.transform(Integer.MIN_VALUE - 1L);
}
Also used : DmnDataTypeTransformer(org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 12 with DmnDataTypeTransformer

use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.

the class DmnDataTypeTransformerTest method dateType.

@Test
public void dateType() throws ParseException {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("date");
    Date date = toDate("2015-09-18T12:00:00");
    TypedValue dateValue = Variables.dateValue(date);
    assertThat(typeTransformer.transform("2015-09-18T12:00:00"), is(dateValue));
    assertThat(typeTransformer.transform(date), is(dateValue));
}
Also used : DmnDataTypeTransformer(org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer) Date(java.util.Date) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 13 with DmnDataTypeTransformer

use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.

the class DmnDataTypeTransformerTest method doubleType.

@Test
public void doubleType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("double");
    assertThat(typeTransformer.transform(4.2), is((TypedValue) Variables.doubleValue(4.2)));
    assertThat(typeTransformer.transform("4.2"), is((TypedValue) Variables.doubleValue(4.2)));
    assertThat(typeTransformer.transform(4), is((TypedValue) Variables.doubleValue(4.0)));
    assertThat(typeTransformer.transform(4L), is((TypedValue) Variables.doubleValue(4.0)));
    assertThat(typeTransformer.transform(Double.MIN_VALUE), is((TypedValue) Variables.doubleValue(Double.MIN_VALUE)));
    assertThat(typeTransformer.transform(Double.MAX_VALUE), is((TypedValue) Variables.doubleValue(Double.MAX_VALUE)));
    assertThat(typeTransformer.transform(-Double.MAX_VALUE), is((TypedValue) Variables.doubleValue(-Double.MAX_VALUE)));
    assertThat(typeTransformer.transform(Long.MAX_VALUE), is((TypedValue) Variables.doubleValue((double) Long.MAX_VALUE)));
}
Also used : DmnDataTypeTransformer(org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 14 with DmnDataTypeTransformer

use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.

the class DmnDataTypeTransformerTest method invalidStringValueForDoubleType.

@Test
public void invalidStringValueForDoubleType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("double");
    thrown.expect(IllegalArgumentException.class);
    typeTransformer.transform("NaD");
}
Also used : DmnDataTypeTransformer(org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Example 15 with DmnDataTypeTransformer

use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.

the class DmnDataTypeTransformerTest method invalidStringValueForLongType.

@Test
public void invalidStringValueForLongType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("long");
    thrown.expect(IllegalArgumentException.class);
    typeTransformer.transform("4.2");
}
Also used : DmnDataTypeTransformer(org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Aggregations

DmnDataTypeTransformer (org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer)17 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)17 Test (org.junit.Test)17 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)6 Date (java.util.Date)1