use of org.estatio.module.capex.dom.project.Project in project estatio by estatio.
the class Project_IntegTest method addChildProject_works.
@Test
public void addChildProject_works() throws Exception {
// given
Project parent = Project_enum.KalProject1.findUsing(serviceRegistry);
Project child = Project_enum.KalProject2.findUsing(serviceRegistry);
// when
wrap(parent).addChildProject(child);
transactionService.nextTransaction();
// then
assertThat(child.getParent()).isEqualTo(parent);
assertThat(parent.getChildren()).contains(child);
}
use of org.estatio.module.capex.dom.project.Project in project estatio by estatio.
the class Project_IntegTest method create_parent_project_works.
@Test
public void create_parent_project_works() throws Exception {
// given
Project child = Project_enum.KalProject1.findUsing(serviceRegistry);
// when
final String reference = "KAL-PARENT";
final String name = "Kal Parent Project";
Project parent = wrap(child).createParentProject(reference, name, null, null);
// then
assertThat(child.getParent()).isEqualTo(parent);
assertThat(parent.getChildren()).contains(child);
assertThat(parent.getReference()).isEqualTo(reference);
assertThat(parent.getName()).isEqualTo(name);
}
use of org.estatio.module.capex.dom.project.Project in project estatio by estatio.
the class Project_IntegTest method parent_project_cannot_add_a_child_that_already_has_a_parent.
@Test
public void parent_project_cannot_add_a_child_that_already_has_a_parent() throws Exception {
// given
Project parent = Project_enum.KalProject1.findUsing(serviceRegistry);
Project child = Project_enum.KalProject2.findUsing(serviceRegistry);
wrap(child).createParentProject("Some ref", "some name", null, null);
// expect
expectedExceptions.expect(InvalidException.class);
expectedExceptions.expectMessage("Reason: The child project is linked to a parent already.");
// when
wrap(parent).addChildProject(child);
}
Aggregations