### Question:
Branch implements ProjectEntity { public static Branch of(Project project, NameDescription nameDescription) { return of(project, nameDescription.asState()); }  static Branch of(Project project, NameDescription nameDescription); static Branch of(Project project, NameDescriptionState nameDescription); @Override ProjectEntityType getProjectEntityType(); @Override String getEntityDisplayName(); Branch withId(ID id); static Form form(); Form toForm(); Branch update(NameDescriptionState form);  }### Answer:
@Test public void collection_without_projects() throws JsonProcessingException { Project project = Project.of(new NameDescription("PRJ", "Project")); List<Branch> branches = Arrays.asList( Branch.of(project, new NameDescription("B1", "Branch 1")).withSignature(SIGNATURE), Branch.of(project, new NameDescription("B2", "Branch 2")).withSignature(SIGNATURE) ); assertJsonWrite( array() .with(object() .with("id", 0) .with("name", "B1") .with("description", "Branch 1") .with("disabled", false) .with("type", "CLASSIC") .with("signature", SIGNATURE_OBJECT) .end()) .with(object() .with("id", 0) .with("name", "B2") .with("description", "Branch 2") .with("disabled", false) .with("type", "CLASSIC") .with("signature", SIGNATURE_OBJECT) .end()) .end(), branches, List.class ); }
@Test public void branch_with_project() throws JsonProcessingException { Project project = Project.of(new NameDescription("PRJ", "Project")).withSignature(SIGNATURE); Branch branch = Branch.of(project, new NameDescription("B", "Branch")).withSignature(SIGNATURE); assertJsonWrite( object() .with("id", 0) .with("name", "B") .with("description", "Branch") .with("disabled", false) .with("type", "CLASSIC") .with("project", object() .with("id", 0) .with("name", "PRJ") .with("description", "Project") .with("disabled", false) .with("signature", SIGNATURE_OBJECT) .end()) .with("signature", SIGNATURE_OBJECT) .end(), branch, Branch.class ); }