ItEr25S07CUAsignacionGrupoRecursosAPlanificacionItEr24S08: The GenericResourceAllocation takes the criterions of the task

This commit is contained in:
Óscar González Fernández 2009-09-08 16:26:22 +02:00 committed by Javier Moran Rua
parent 1920996a1c
commit d2f16a4bae
2 changed files with 48 additions and 0 deletions

View file

@ -32,6 +32,7 @@ public class GenericResourceAllocation extends ResourceAllocation {
private GenericResourceAllocation(Task task) {
super(task);
this.criterions = task.getCriterions();
}
public Set<GenericDayAssigment> getGenericDayAssigments() {

View file

@ -0,0 +1,47 @@
package org.navalplanner.business.test.planner.entities;
import static org.easymock.EasyMock.expect;
import static org.easymock.classextension.EasyMock.createNiceMock;
import static org.easymock.classextension.EasyMock.replay;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import java.util.HashSet;
import java.util.Set;
import org.junit.Test;
import org.navalplanner.business.planner.entities.GenericResourceAllocation;
import org.navalplanner.business.planner.entities.Task;
import org.navalplanner.business.resources.entities.Criterion;
public class GenericResourceAllocationTest {
private GenericResourceAllocation genericResourceAllocation;
private Set<Criterion> criterions;
private void givenGenericResourceAllocation() {
Task task = createNiceMock(Task.class);
expect(task.getCriterions()).andReturn(givenPredefinedCriterions());
replay(task);
genericResourceAllocation = GenericResourceAllocation.create(task);
}
private Set<Criterion> givenPredefinedCriterions() {
Set<Criterion> result = new HashSet<Criterion>();
Criterion criterion1 = createNiceMock(Criterion.class);
Criterion criterion2 = createNiceMock(Criterion.class);
replay(criterion1, criterion2);
result.add(criterion1);
result.add(criterion2);
this.criterions = result;
return result;
}
@Test
public void hasTheCriterionsOfTheTask() {
givenGenericResourceAllocation();
assertThat(genericResourceAllocation.getCriterions(),
equalTo(criterions));
}
}