ItEr34S12CUCreacionUnidadesPlanificacionItEr33S14: Specifying behaviour for when removing the last child
This commit is contained in:
parent
f7f0ac6250
commit
3df2940dae
2 changed files with 15 additions and 4 deletions
|
|
@ -226,14 +226,16 @@ public class SchedulingState {
|
|||
}
|
||||
|
||||
private void typeChangedOnChild(SchedulingState child) {
|
||||
if (getType().belongsToSchedulingPoint()) {
|
||||
return;
|
||||
}
|
||||
setType(calculateTypeFromChildren());
|
||||
}
|
||||
|
||||
private Type calculateTypeFromChildren() {
|
||||
Validate.isTrue(!children.isEmpty());
|
||||
if (getType().belongsToSchedulingPoint()) {
|
||||
return getType();
|
||||
}
|
||||
if (children.isEmpty()) {
|
||||
return Type.NO_SCHEDULED;
|
||||
}
|
||||
boolean allScheduled = true;
|
||||
boolean someScheduled = false;
|
||||
for (SchedulingState each : children) {
|
||||
|
|
|
|||
|
|
@ -299,6 +299,15 @@ public class SchedulingStateTest {
|
|||
assertTrue(typeChanged[0]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removingAllTheChildrenOfACompletelyScheduledSuperelementMakesItNoScheduled() {
|
||||
childA.schedule();
|
||||
childB.schedule();
|
||||
root.removeChild(childA);
|
||||
root.removeChild(childB);
|
||||
assertThat(root, hasType(Type.NO_SCHEDULED));
|
||||
}
|
||||
|
||||
abstract static class SchedulingStateMatcher extends
|
||||
BaseMatcher<SchedulingState> {
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue