private void checkEquality(PrimitiveClass primitive, BoxedClass boxed) { assertEquals(primitive.isMyBoolean(), boxed.getMyBoolean()); assertEquals(primitive.getMyByte(), boxed.getMyByte().byteValue()); assertEquals(primitive.getMyCharacter(), boxed.getMyCharacter().charValue()); assertEquals(primitive.getMyDouble(), boxed.getMyDouble(), 0.001); assertEquals(primitive.getMyFloat(), boxed.getMyFloat(), 0.001); assertEquals(primitive.getMyInt(), boxed.getMyInt().intValue()); assertEquals(primitive.getMyLong(), boxed.getMyLong().longValue()); assertEquals(primitive.getMyShort(), boxed.getMyShort().shortValue()); }
@Test public void testNullBoxing() { BoxedClass boxed = new BoxedClass(); PrimitiveClass primitive = ubiquity.map(boxed, PrimitiveClass.class); assertEquals(false, primitive.isMyBoolean()); assertEquals(0, primitive.getMyByte()); assertEquals(0, primitive.getMyCharacter()); assertEquals(0, primitive.getMyInt()); assertEquals(0, primitive.getMyShort()); assertEquals(0, primitive.getMyLong()); assertEquals(0, primitive.getMyFloat(), 0.01); assertEquals(0, primitive.getMyDouble(), 0.01); }