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);
}
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));
}
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)));
}
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");
}
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");
}
Aggregations