ProjectType { protected void addParent(ProjectType parent) { parents.add(parent); } protected  ProjectType(String id, String displayName, boolean primaryable, boolean mixable, boolean persisted); protected  ProjectType(String id, String displayName, boolean primaryable, boolean mixable); boolean isPersisted(); String getId(); String getDisplayName(); List<Attribute> getAttributes(); List<ProjectType> getParents(); boolean isTypeOf(String typeId); String getDefaultBuilder(); String getDefaultRunner(); Attribute getAttribute(String name); List<String> getRunnerCategories(); boolean canBeMixin(); boolean canBePrimary();  }
@Test public void testInvalidPTDefinition() throws Exception { ProjectType pt = new ProjectType("my", "second", true, false) {}; Set<ProjectType> pts = new HashSet<>(); pts.add(new MyProjectType(null)); pts.add(pt); ProjectTypeRegistry reg = new ProjectTypeRegistry(pts); Assert.assertEquals(2, reg.getProjectTypes().size()); pts.clear(); pts.add(new ProjectType(null, "null id", true, false) {}); pts.add(new ProjectType("", "empty id", true, false) {}); pts.add(new ProjectType("invalid id", "invalid id", true, false) {}); pts.add(new ProjectType("id1", null, true, false) {}); pts.add(new ProjectType("id2", "", true, false) {}); reg = new ProjectTypeRegistry(pts); Assert.assertEquals(1, reg.getProjectTypes().size()); final ProjectType invalidParent = new ProjectType("parent", "parent", true, false) { }; pts.add(new ProjectType("notRegParent", "not reg parent", true, false) { { addParent(invalidParent); } }); reg = new ProjectTypeRegistry(pts); Assert.assertEquals(1, reg.getProjectTypes().size()); }