ItEr18S14CUAsignacionRecursosEspecificosAPlanificacion: Added basic unit tests to add and remove a ResourceAllocation.
This commit is contained in:
parent
5861e44f1a
commit
657e0429f3
1 changed files with 30 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
import org.junit.Test;
|
||||
import org.navalplanner.business.orders.entities.HoursGroup;
|
||||
import org.navalplanner.business.planner.entities.SpecificResourceAllocation;
|
||||
import org.navalplanner.business.planner.entities.Task;
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
|
||||
|
|
@ -46,4 +47,32 @@ public class TaskTest {
|
|||
return Task.createTask(hours);
|
||||
}
|
||||
|
||||
}
|
||||
@Test
|
||||
public void taskAddResourceAllocation() {
|
||||
assertThat(task.getResourceAllocations().size(), equalTo(0));
|
||||
|
||||
SpecificResourceAllocation resourceAllocation = new SpecificResourceAllocation(
|
||||
task);
|
||||
task.addResourceAllocation(resourceAllocation);
|
||||
|
||||
assertThat(task.getResourceAllocations().size(), equalTo(1));
|
||||
assertThat(
|
||||
resourceAllocation.getTask().getResourceAllocations().size(),
|
||||
equalTo(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void taskRemoveResourceAllocation() {
|
||||
assertThat(task.getResourceAllocations().size(), equalTo(0));
|
||||
|
||||
SpecificResourceAllocation resourceAllocation = new SpecificResourceAllocation(
|
||||
task);
|
||||
task.addResourceAllocation(resourceAllocation);
|
||||
|
||||
assertThat(task.getResourceAllocations().size(), equalTo(1));
|
||||
|
||||
task.removeResourceAllocation(resourceAllocation);
|
||||
assertThat(task.getResourceAllocations().size(), equalTo(0));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue