use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method stringType.
@Test
public void stringType() {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("string");
assertThat(typeTransformer.transform("abc"), is((TypedValue) Variables.stringValue("abc")));
assertThat(typeTransformer.transform(true), is((TypedValue) Variables.stringValue("true")));
assertThat(typeTransformer.transform(4), is((TypedValue) Variables.stringValue("4")));
assertThat(typeTransformer.transform(2L), is((TypedValue) Variables.stringValue("2")));
assertThat(typeTransformer.transform(4.2), is((TypedValue) Variables.stringValue("4.2")));
}
use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method integerType.
@Test
public void integerType() {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("integer");
assertThat(typeTransformer.transform(4), is((TypedValue) Variables.integerValue(4)));
assertThat(typeTransformer.transform("4"), is((TypedValue) Variables.integerValue(4)));
assertThat(typeTransformer.transform(2L), is((TypedValue) Variables.integerValue(2)));
assertThat(typeTransformer.transform(4.0), is((TypedValue) Variables.integerValue(4)));
assertThat(typeTransformer.transform(Integer.MIN_VALUE), is((TypedValue) Variables.integerValue(Integer.MIN_VALUE)));
assertThat(typeTransformer.transform(Integer.MAX_VALUE), is((TypedValue) Variables.integerValue(Integer.MAX_VALUE)));
}
use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method invalidStringValueForIntegerType.
@Test
public void invalidStringValueForIntegerType() {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("integer");
thrown.expect(IllegalArgumentException.class);
typeTransformer.transform("4.2");
}
use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method invalidStringForDateType.
@Test
public void invalidStringForDateType() {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("date");
thrown.expect(IllegalArgumentException.class);
typeTransformer.transform("18.09.2015 12:00:00");
}
use of org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer in project camunda-engine-dmn by camunda.
the class DmnDataTypeTransformerTest method invalidDoubleMinValueForLongType.
@Test
public void invalidDoubleMinValueForLongType() {
DmnDataTypeTransformer typeTransformer = registry.getTransformer("long");
thrown.expect(IllegalArgumentException.class);
typeTransformer.transform(Double.MIN_VALUE);
}
Aggregations