### Question:
TreeUtil { public static String toYaml(Object obj) throws EncodeException { try { return yaml.writeValueAsString(obj); } catch (Exception e) { throw new EncodeException(String.format(ENCODE_ERR_MSG, e.getMessage())); } } private  TreeUtil(); static String toJson(Object obj); static JsonNode toJsonNode(Object obj); static String toYaml(Object obj); static T load(final URL url, Class<T> clazz); static T load(final URL url, final List<AuthOption> authOptions, Class<T> clazz); static JsonNode load(final URL url); static JsonNode load(final URL url, final List<AuthOption> authOptions); static final String ENCODE_ERR_MSG; static final ObjectMapper json; static final ObjectMapper yaml; }### Answer:
@Test(expected = EncodeException.class) public void toYaml() throws EncodeException { Map<String, Object> map = new HashMap<>(); map.put("akey", "aValue"); assertEquals("---\nakey: \"aValue\"\n", TreeUtil.toYaml(map)); map.put(null, "aValue"); TreeUtil.toYaml(map); }