public void testSetPrimitiveTypes() throws Exception { Destination destination = new Destination(); PropertyUtils.setProperty(destination, "aString", "this is my string"); PropertyUtils.setProperty(destination, "aBoolean", "true"); PropertyUtils.setProperty(destination, "aByte", "100"); PropertyUtils.setProperty(destination, "aShort", "20000"); PropertyUtils.setProperty(destination, "anInteger", "300000"); PropertyUtils.setProperty(destination, "aLong", "4000000"); PropertyUtils.setProperty(destination, "aFloat", "3.14"); PropertyUtils.setProperty(destination, "aDouble", "0.654987"); assertEquals("this is my string", destination.getAString()); assertEquals(true, destination.isABoolean()); assertEquals(100, destination.getAByte()); assertEquals(20000, destination.getAShort()); assertEquals(300000, destination.getAnInteger()); assertEquals(4000000, destination.getALong()); assertEquals(3.14f, destination.getAFloat(), 0.01f); assertEquals(0.654987, destination.getADouble(), 0.000001); }
public void testSetPrimitiveTypes() throws Exception { Destination destination = new Destination(); PropertyUtils.setProperty(destination, "aString", "this is my string"); PropertyUtils.setProperty(destination, "aBoolean", "true"); PropertyUtils.setProperty(destination, "aByte", "100"); PropertyUtils.setProperty(destination, "aShort", "20000"); PropertyUtils.setProperty(destination, "anInteger", "300000"); PropertyUtils.setProperty(destination, "aLong", "4000000"); PropertyUtils.setProperty(destination, "aFloat", "3.14"); PropertyUtils.setProperty(destination, "aDouble", "0.654987"); assertEquals("this is my string", destination.getAString()); assertEquals(true, destination.isABoolean()); assertEquals(100, destination.getAByte()); assertEquals(20000, destination.getAShort()); assertEquals(300000, destination.getAnInteger()); assertEquals(4000000, destination.getALong()); assertEquals(3.14f, destination.getAFloat(), 0.01f); assertEquals(0.654987, destination.getADouble(), 0.000001); }