### Question:
GPlusEventClassifier implements Serializable { public static Class detectClass(String json) { Objects.requireNonNull(json); Preconditions.checkArgument(StringUtils.isNotEmpty(json)); ObjectNode objectNode; try { objectNode = (ObjectNode) mapper.readTree(json); } catch (IOException ex) { ex.printStackTrace(); return null; } if (objectNode.findValue("kind") != null && objectNode.get("kind").toString().equals(ACTIVITY_IDENTIFIER)) { return Activity.class; } else if (objectNode.findValue("kind") != null && objectNode.get("kind").toString().equals(PERSON_IDENTIFIER)) { return Person.class; } else { return ObjectNode.class; } }  static Class detectClass(String json);  }### Answer:
@Test public void classifyActivityTest() { try { Activity activity = new Activity(); activity.setKind("plus#activity"); Class retClass = GPlusEventClassifier.detectClass(mapper.writeValueAsString(activity)); Assert.assertEquals(retClass, Activity.class); } catch (Exception ex) { } }
@Test public void classifyPersonTest() { try { Person person = new Person(); person.setKind("plus#person"); Class retClass = GPlusEventClassifier.detectClass(mapper.writeValueAsString(person)); Assert.assertEquals(retClass, Person.class); } catch (Exception ex) { } }
@Test public void classifyObjectNodeTest() { try { Person person = new Person(); person.setKind("fake"); Class retClass = GPlusEventClassifier.detectClass(mapper.writeValueAsString(person)); Assert.assertEquals(retClass, ObjectNode.class); } catch (Exception ex) { } }