### Question:
ContentTypeResolver { public static ContentType resolveFromPayload(String payload) { if (payload != null) { if (payload.startsWith("<")) { return ContentType.XML; } else if (payload.startsWith("{") || payload.startsWith("[")) { return ContentType.JSON; } else if (!payload.isEmpty()) { return ContentType.TEXT; } } return null; }  static ContentType resolveFromPayload(String payload);  }### Answer:
@Test public void resolveContentType() { assertEquals(ContentType.XML, resolveFromPayload("<project></project>")); assertEquals(ContentType.JSON, resolveFromPayload("{project:[version: 123]}")); assertEquals(ContentType.TEXT, resolveFromPayload("Hello")); }