### Question:
TypedMap implements Map<String, Object> { public Object put(String arg0, Object arg1) { return inner.put(arg0, convertToTypedObject(arg0, arg1)); } TypedMap(final RecordType type);  TypedMap(final RecordType type,
            final Map<? extends String, ? extends Object> map); RecordType getType(); Type getFieldType(final String fieldName); void clear(); boolean containsKey(Object arg0); boolean containsValue(Object arg0); Set<Entry<String, Object>> entrySet(); Object get(Object arg0); boolean isEmpty(); Set<String> keySet(); Object put(String arg0, Object arg1); void putAll(Map<? extends String, ? extends Object> arg0); Object remove(Object arg0); int size(); Collection<Object> values(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testCreate() throws Exception { new TypedMap(recordType); Map<String, Object> values = new HashMap<String, Object>(); values.put("intValue", 1); values.put("booleanValue", true); values.put("stringArray", new String[] { "a", "b", "c" }); new TypedMap(recordType, values); Map<String, Object> values2 = new HashMap<String, Object>(); values2.put("intValue", 1); values2.put("booleanValue", "false"); values2.put("stringArray", new String[] { "a", "b", "c" }); try { new TypedMap(recordType, values2); fail(); } catch (UnassignableValueException e) { } Map<String, Object> values3 = new HashMap<String, Object>(); values3.put("intValue", 1); values3.put("longValue", 52L); values3.put("stringArray", new String[] { "a", "b", "c" }); try { new TypedMap(recordType, values3); fail(); } catch (NoSuchRecordFieldException e) { } }
@Test public void testPut() throws Exception { Map<String, Object> values = new HashMap<String, Object>(); values.put("intValue", 1); values.put("booleanValue", true); String[] stringArray = new String[] { "a", "b", "c" }; values.put("stringArray", stringArray); TypedMap map = new TypedMap(recordType, values); assertEquals(1, map.put("intValue", 2)); assertEquals(2, map.get("intValue")); try { map.put("longValue", 5L); fail(); } catch (NoSuchRecordFieldException e) { } try { map.put("booleanValue", "true"); fail(); } catch (UnassignableValueException e) { } }