TypeHierarchy { protected void addSupertype(String type, String supertype) { if (!supertypesByType.containsKey(type)) { supertypesByType.put(type, new HashSet<>()); } if (!type.equals(supertype)) { supertypesByType.get(type).add(supertype); } } protected  TypeHierarchy(); boolean isA(String type, String supertype);  }
@Test public void addSuperType() throws Exception { TypeHierarchy hierarchy = new TypeHierarchy(); hierarchy.addSupertype("A", "S"); assertTrue(hierarchy.isA("A", "S")); }