### Question:
GroupId { public GroupId(Object objectId) throws IllegalArgumentException { if(objectId == null) { this.objectId = new ObjectId(""); } else if(objectId instanceof ObjectId) { this.objectId = (ObjectId) objectId; } else { if(Type.objectId.equals(getType(objectId))) { this.objectId = new ObjectId(objectId.toString()); } else { this.objectId = objectId.toString(); } } } GroupId(Object objectId);  GroupId(Type type, String objectId); Type getType(); void setObjectId(String objectId); Object getObjectId(); static GroupId fromJson(String jsonId); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testGroupId() { DomainName dn1 = new DomainName("example.com"); LocalId l1 = new LocalId("195mg90a39v"); GlobalId gl1 = new GlobalId(dn1, l1); GroupId g1 = new GroupId("example.com:195mg90a39v"); GroupId g2 = new GroupId(gl1); assertEquals(g1.getType(), g2.getType()); assertEquals(g1.getObjectId().toString(), g2.getObjectId().toString()); GroupId g3 = new GroupId("@foo"); assertEquals(Type.custom, g3.getType()); assertEquals("@foo", g3.getObjectId().toString()); GroupId g4 = new GroupId(Type.objectId, "example.com:195mg90a39v"); assertEquals(Type.objectId, g4.getType()); assertEquals("example.com:195mg90a39v", g4.getObjectId().toString()); GroupId g5 = new GroupId(Type.custom, "@foo"); assertEquals(Type.custom, g5.getType()); assertEquals("@foo", g5.getObjectId().toString()); GroupId g6 = new GroupId(Type.all, "something"); assertEquals(Type.all, g6.getType()); assertEquals("@all", g6.getObjectId().toString()); GroupId g7 = new GroupId(Type.self, null); assertEquals(Type.self, g7.getType()); assertEquals("@self", g7.getObjectId().toString()); GroupId g8 = new GroupId(Type.friends, "bar"); assertEquals(Type.friends, g8.getType()); assertEquals("@friends", g8.getObjectId().toString()); }