ItEr34S08ValidacionEProbasFuncionaisItEr33S08: Providing the type is always necessary

This commit is contained in:
Óscar González Fernández 2009-11-15 20:12:40 +01:00
parent 112d941474
commit c9164d982b
3 changed files with 4 additions and 3 deletions

View file

@ -98,7 +98,7 @@ public abstract class OrderElement extends BaseEntity {
List<SchedulingState> childrenStates = getChildrenStates();
SchedulingState result = childrenStates.isEmpty() ? new SchedulingState(
getSchedulingStateType())
: new SchedulingState(childrenStates);
: new SchedulingState(schedulingStateType, childrenStates);
result.addTypeChangeListener(new ITypeChangedListener() {
@Override
public void typeChanged(Type newType) {

View file

@ -138,7 +138,8 @@ public class SchedulingState {
public SchedulingState() {
}
public SchedulingState(List<SchedulingState> children) {
public SchedulingState(Type type, List<SchedulingState> children) {
this(type);
for (SchedulingState each : children) {
if (!each.isRoot()) {
throw new IllegalArgumentException(each

View file

@ -91,7 +91,7 @@ public class SchedulingStateTest {
@Test(expected = IllegalArgumentException.class)
public void cannotCreateASchedulingStateWithChildrenAlreadyAssigned() {
new SchedulingState(Arrays.asList(childA));
new SchedulingState(Type.NO_SCHEDULED, Arrays.asList(childA));
}
@Test