}
@Test
public void createProjectShouldMakeAProject() {
UserMetadata userMetadata = tx.createUser("test");
ProjectMetadata projectMetadata = tx.createProject("test", userMetadata);
Assert.assertNotNull(projectMetadata);
Assert.assertEquals(projectMetadata.getName(), "test");
// Make sure the branch is linked to the project.
BranchMetadata branchMetadata = projectMetadata.getCurrentBranch();
Assert.assertNotNull(branchMetadata);
Assert.assertEquals(branchMetadata.getName(), "master");
Assert.assertEquals(branchMetadata.getProject(), projectMetadata);
Assert.assertThat(projectMetadata.getBranches(), hasItem(branchMetadata));
// Make sure the graph is linked to the project.
GraphMetadata graphMetadata = branchMetadata.getGraph();
Assert.assertNotNull(graphMetadata);
Assert.assertEquals(graphMetadata.getProject(), projectMetadata);
Assert.assertThat(projectMetadata.getGraphs(), hasItem(graphMetadata));
// Make sure the graph links are empty.
Assert.assertNull(graphMetadata.getParentGraph());
Assert.assertEquals(graphMetadata.getChildGraphs().iterator().hasNext(), false);
}