ItEr16S12CreacionProxectoPlanificacion: the task elements collection of taskGroup cannot be modified.
This commit is contained in:
parent
263312e730
commit
cbde05db74
2 changed files with 7 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
|
@ -13,7 +14,7 @@ public class TaskGroup extends TaskElement {
|
|||
private List<TaskElement> taskElements = new ArrayList<TaskElement>();
|
||||
|
||||
public List<TaskElement> getTaskElements() {
|
||||
return taskElements;
|
||||
return Collections.unmodifiableList(taskElements);
|
||||
}
|
||||
|
||||
public void addTaskElement(TaskElement task) {
|
||||
|
|
|
|||
|
|
@ -42,4 +42,9 @@ public class TaskGroupTest {
|
|||
public void cantAddNullTaskElement() {
|
||||
taskGroup.addTaskElement(null);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void taskElementsCollectionCannotBeModified() {
|
||||
taskGroup.getTaskElements().set(0, null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue