### Question:
PropertyParser { public char toChar(String name) { return toChar(name, '\u0000'); } PropertyParser(Properties properties); Properties getProperties(); void setProperties(Properties properties); String parseString(String name); int parseInt(String name); boolean parseBoolean(String name); float parseFloat(String name); double parseDouble(String name); long parseLong(String name); char parseChar(String name); String toString(String name); int toInt(String name); boolean toBoolean(String name); float toFloat(String name); double toDouble(String name); long toLong(String name); char toChar(String name); String toString(String name, String defaultValue); int toInt(String name, int defaultValue); boolean toBoolean(String name, boolean defaultValue); float toFloat(String name, float defaultValue); double toDouble(String name, double defaultValue); long toLong(String name, long defaultValue); char toChar(String name, char defaultValue);  }### Answer:
@Test public void testToChar_String() { System.out.println("toChar"); char expResult; char result; Properties props = new Properties(); props.put("value1", "f"); props.put("value2", "w"); props.put("empty", ""); props.put("str", "abc"); props.put("boolean", "true"); props.put("float", "24.98"); props.put("int", "12"); props.put("char", "a"); PropertyParser instance = new PropertyParser(props); expResult = 'f'; result = instance.toChar("value1"); assertEquals(expResult, result); expResult = 'w'; result = instance.toChar("value2"); assertEquals(expResult, result); expResult = '\u0000'; result = instance.toChar("empty"); assertEquals(expResult, result); expResult = '\u0000'; result = instance.toChar("str"); assertEquals(expResult, result); expResult = '\u0000'; result = instance.toChar("boolean"); assertEquals(expResult, result); expResult = '\u0000'; result = instance.toChar("float"); assertEquals(expResult, result); expResult = '\u0000'; result = instance.toChar("int"); assertEquals(expResult, result); expResult = 'a'; result = instance.toChar("char"); assertEquals(expResult, result); expResult = '\u0000'; result = instance.toChar("nonexistent"); assertEquals(expResult, result); }
@Test public void testToChar_String_char() { System.out.println("toChar"); char expResult; char result; Properties props = new Properties(); props.put("value1", "f"); props.put("value2", "w"); props.put("empty", ""); props.put("str", "abc"); props.put("boolean", "true"); props.put("float", "24.98"); props.put("int", "12"); props.put("char", "a"); PropertyParser instance = new PropertyParser(props); expResult = 'f'; result = instance.toChar("value1", 't'); assertEquals(expResult, result); expResult = 'w'; result = instance.toChar("value2", 't'); assertEquals(expResult, result); expResult = 't'; result = instance.toChar("empty", 't'); assertEquals(expResult, result); expResult = 't'; result = instance.toChar("str", 't'); assertEquals(expResult, result); expResult = 't'; result = instance.toChar("boolean", 't'); assertEquals(expResult, result); expResult = 't'; result = instance.toChar("float", 't'); assertEquals(expResult, result); expResult = 't'; result = instance.toChar("int", 't'); assertEquals(expResult, result); expResult = 'a'; result = instance.toChar("char", 't'); assertEquals(expResult, result); expResult = 't'; result = instance.toChar("nonexistent", 't'); assertEquals(expResult, result); }