Fix unit tests
Because of the new behavior 'disable sub-stages when parent stage is disabled', some unit tests needed to be rewritten
This commit is contained in:
parent
9191d9df51
commit
6b23576c34
@ -179,23 +179,26 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
*/
|
*/
|
||||||
public void setOnlyStage(final int stageNumber) {
|
public void setOnlyStage(final int stageNumber) {
|
||||||
_setAllStages(false);
|
_setAllStages(false);
|
||||||
_setStageActive(stageNumber, true);
|
_setStageActive(stageNumber, true, false);
|
||||||
updateMotors();
|
updateMotors();
|
||||||
updateActiveInstances();
|
updateActiveInstances();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method flags the specified stage as requested. Other stages are unaffected.
|
* This method flags the specified stage as requested. Other stages are unaffected.
|
||||||
*
|
*
|
||||||
* @param stageNumber stage number to flag
|
* @param stageNumber stage number to flag
|
||||||
* @param _active inactive (<code>false</code>) or active (<code>true</code>)
|
* @param _active inactive (<code>false</code>) or active (<code>true</code>)
|
||||||
|
* @param activateSubStages whether the sub-stages of the specified stage should be activated as well.
|
||||||
*/
|
*/
|
||||||
public void _setStageActive(final int stageNumber, final boolean _active ) {
|
public void _setStageActive(final int stageNumber, final boolean _active, final boolean activateSubStages) {
|
||||||
if ((0 <= stageNumber) && (stages.containsKey(stageNumber))) {
|
if ((0 <= stageNumber) && (stages.containsKey(stageNumber))) {
|
||||||
stages.get(stageNumber).active = _active;
|
stages.get(stageNumber).active = _active;
|
||||||
// Set the active state of all the sub-stages as well.
|
if (activateSubStages) {
|
||||||
for (AxialStage stage : rocket.getStage(stageNumber).getSubStages()) {
|
// Set the active state of all the sub-stages as well.
|
||||||
stages.get(stage.getStageNumber()).active = _active;
|
for (AxialStage stage : rocket.getStage(stageNumber).getSubStages()) {
|
||||||
|
stages.get(stage.getStageNumber()).active = _active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
return;
|
return;
|
||||||
@ -203,6 +206,16 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
log.error("error: attempt to retrieve via a bad stage number: " + stageNumber);
|
log.error("error: attempt to retrieve via a bad stage number: " + stageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method flags the specified stage as requested. Actives the sub-stages of the specified stage as well.
|
||||||
|
*
|
||||||
|
* @param stageNumber stage number to flag
|
||||||
|
* @param _active inactive (<code>false</code>) or active (<code>true</code>)
|
||||||
|
*/
|
||||||
|
public void _setStageActive(final int stageNumber, final boolean _active ) {
|
||||||
|
_setStageActive(stageNumber, _active, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void toggleStage(final int stageNumber) {
|
public void toggleStage(final int stageNumber) {
|
||||||
if ((0 <= stageNumber) && (stages.containsKey(stageNumber))) {
|
if ((0 <= stageNumber) && (stages.containsKey(stageNumber))) {
|
||||||
|
@ -364,7 +364,6 @@ public class FlightConfigurationTest extends BaseTestCase {
|
|||||||
|
|
||||||
selected.clearAllStages();
|
selected.clearAllStages();
|
||||||
selected.toggleStage(1);
|
selected.toggleStage(1);
|
||||||
selected.toggleStage(2);
|
|
||||||
|
|
||||||
// vvvv Test Target vvvv
|
// vvvv Test Target vvvv
|
||||||
InstanceMap instances = selected.getActiveInstances();
|
InstanceMap instances = selected.getActiveInstances();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user