use of org.mapstruct.ap.test.nestedproperties.simple.source.SourceProps in project mapstruct by mapstruct.
the class SimpleNestedPropertiesTest method testFilled.
@ProcessorTest
@WithClasses({ SimpleMapper.class })
public void testFilled() {
SourceRoot sourceRoot = new SourceRoot();
SourceProps sourceProps = new SourceProps();
sourceRoot.setProps(sourceProps);
sourceProps.publicLongValue = Long.MAX_VALUE;
sourceProps.setLongValue(Long.MAX_VALUE);
sourceProps.setIntValue(Integer.MAX_VALUE);
sourceProps.setDoubleValue(Double.MAX_VALUE);
sourceProps.setFloatValue(Float.MAX_VALUE);
sourceProps.setShortValue(Short.MAX_VALUE);
sourceProps.setCharValue(Character.MAX_VALUE);
sourceProps.setByteValue(Byte.MAX_VALUE);
sourceProps.setBooleanValue(true);
String stringValue = "lorem ipsum";
sourceProps.setByteArray(stringValue.getBytes());
sourceProps.setStringValue(stringValue);
TargetObject targetObject = SimpleMapper.MAPPER.toTargetObject(sourceRoot);
assertEquals(Long.MAX_VALUE, targetObject.getPublicLongValue());
assertEquals(Long.MAX_VALUE, targetObject.getLongValue());
assertEquals(Integer.MAX_VALUE, targetObject.getIntValue());
assertEquals(Double.MAX_VALUE, targetObject.getDoubleValue(), 0.01);
assertEquals(Float.MAX_VALUE, targetObject.getFloatValue(), 0.01f);
assertEquals(Short.MAX_VALUE, targetObject.getShortValue());
assertEquals(Character.MAX_VALUE, targetObject.getCharValue());
assertEquals(Byte.MAX_VALUE, targetObject.getByteValue());
assertTrue(targetObject.isBooleanValue());
assertArrayEquals(stringValue.getBytes(), targetObject.getByteArray());
assertEquals(stringValue, targetObject.getStringValue());
}
Aggregations