### Question:
PropertySetter extends ContextAwareBase { public void setProperty(String name, String value) { if (value == null) { return; } name = Introspector.decapitalize(name); PropertyDescriptor prop = getPropertyDescriptor(name); if (prop == null) { addWarn("No such property [" + name + "] in " + objClass.getName() + "."); } else { try { setProperty(prop, name, value); } catch (PropertySetterException ex) { addWarn("Failed to set property [" + name + "] to value \"" + value + "\". ", ex); } } } PropertySetter(Object obj); void setProperty(String name, String value); void setProperty(PropertyDescriptor prop, String name, String value); AggregationType computeAggregationType(String name); Class<?> getObjClass(); void addComplexProperty(String name, Object complexProperty); void addBasicProperty(String name, String strValue); void setComplexProperty(String name, Object complexProperty); Object getObj(); Class<?> getClassNameViaImplicitRules(String name,
      AggregationType aggregationType, DefaultNestedComponentRegistry registry);  }### Answer:
@Test public void testSetProperty() { { House house = new House(); PropertySetter setter = new PropertySetter(house); setter.setProperty("count", "10"); setter.setProperty("temperature", "33.1"); setter.setProperty("name", "jack"); setter.setProperty("open", "true"); assertEquals(10, house.getCount()); assertEquals(33.1d, (double) house.getTemperature(), 0.01); assertEquals("jack", house.getName()); assertTrue(house.isOpen()); } { House house = new House(); PropertySetter setter = new PropertySetter(house); setter.setProperty("Count", "10"); setter.setProperty("Name", "jack"); setter.setProperty("Open", "true"); assertEquals(10, house.getCount()); assertEquals("jack", house.getName()); assertTrue(house.isOpen()); } }
@Test public void testSetCamelProperty() { setter.setProperty("camelCase", "trot"); assertEquals("trot", house.getCamelCase()); setter.setProperty("camelCase", "gh"); assertEquals("gh", house.getCamelCase()); }
@Test public void testDuration() { setter.setProperty("duration", "1.4 seconds"); assertEquals(1400, house.getDuration().getMilliseconds()); }
@Test public void testFileSize() { setter.setProperty("fs", "2 kb"); assertEquals(2 * 1024, house.getFs().getSize()); }
@Test public void testFilterReply() { setter.setProperty("filterReply", "ACCEPT"); assertEquals(FilterReply.ACCEPT, house.getFilterReply()); }
@Test public void testEnum() { setter.setProperty("houseColor", "BLUE"); assertEquals(HouseColor.BLUE, house.getHouseColor()); }
@Test public void charset() { setter.setProperty("charset", "UTF-8"); assertEquals(Charset.forName("UTF-8"), house.getCharset()); house.setCharset(null); setter.setProperty("charset", "UTF"); assertNull(house.getCharset()); StatusChecker checker = new StatusChecker(context); checker.containsException(UnsupportedCharsetException.class); }