Search in sources :

Example 1 with DmnDataTypeTransformer

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

the class DmnDataTypeTransformerTest method booleanType.

@Test
public void booleanType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("boolean");
    assertThat(typeTransformer.transform(true), is((TypedValue) Variables.booleanValue(true)));
    assertThat(typeTransformer.transform(false), is((TypedValue) Variables.booleanValue(false)));
    assertThat(typeTransformer.transform("true"), is((TypedValue) Variables.booleanValue(true)));
    assertThat(typeTransformer.transform("false"), is((TypedValue) Variables.booleanValue(false)));
}
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 2 with DmnDataTypeTransformer

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

the class DmnDataTypeTransformerTest method invalidDoubleValueForIntegerType.

@Test
public void invalidDoubleValueForIntegerType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("integer");
    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)

Example 3 with DmnDataTypeTransformer

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

the class DmnDataTypeTransformerTest method invalidStringValueForBooleanType.

@Test
public void invalidStringValueForBooleanType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("boolean");
    thrown.expect(IllegalArgumentException.class);
    typeTransformer.transform("NaB");
}
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 4 with DmnDataTypeTransformer

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

the class DmnDataTypeTransformerTest method invalidIntegerMaxValueForIntegerType.

@Test
public void invalidIntegerMaxValueForIntegerType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("integer");
    thrown.expect(IllegalArgumentException.class);
    typeTransformer.transform(Integer.MAX_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 5 with DmnDataTypeTransformer

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

the class DmnDataTypeTransformerTest method longType.

@Test
public void longType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("long");
    assertThat(typeTransformer.transform(2L), is((TypedValue) Variables.longValue(2L)));
    assertThat(typeTransformer.transform("2"), is((TypedValue) Variables.longValue(2L)));
    assertThat(typeTransformer.transform(4), is((TypedValue) Variables.longValue(4L)));
    assertThat(typeTransformer.transform(4.0), is((TypedValue) Variables.longValue(4L)));
    assertThat(typeTransformer.transform(Long.MIN_VALUE), is((TypedValue) Variables.longValue(Long.MIN_VALUE)));
    assertThat(typeTransformer.transform(Long.MAX_VALUE), is((TypedValue) Variables.longValue(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)

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