Skip to content

Commit

Permalink
Add test coverage
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte committed Jun 17, 2024
1 parent 8ea3e8b commit 0db29de
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ void setupDynawaltzContext() {

protected abstract void addDynamicModels();

protected void addModelIfNotNull(BlackBoxModel... models) {
for (BlackBoxModel model : models) {
if (model != null) {
dynamicModels.add(model);
}
}
}

protected void checkReport(String report) throws IOException {
StringWriter sw = new StringWriter();
reportNode.print(sw);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,20 @@ protected void setupNetwork() {

@Override
protected void addDynamicModels() {
dynamicModels.add(PhaseShifterIAutomationSystemBuilder.of(network)
addModelIfNotNull(
PhaseShifterIAutomationSystemBuilder.of(network, reportNode)
.dynamicModelId("BBM_PS")
.parameterSetId("ps")
.transformer("NGEN_NHV1")
.build());
dynamicModels.add(PhaseShifterBlockingIAutomationSystemBuilder.of(network)
.build(),
PhaseShifterBlockingIAutomationSystemBuilder.of(network, reportNode)
.dynamicModelId("BBM_PSB")
.parameterSetId("psb")
.phaseShifterId("WRONG_ID")
.build(),
PhaseShifterBlockingIAutomationSystemBuilder.of(network, reportNode)
.dynamicModelId("BBM_PSB2")
.parameterSetId("psb")
.build());
}

Expand All @@ -46,6 +51,10 @@ void writeModel() throws SAXException, IOException {
validate("dyd.xsd", "empty_phase_shifter_blocking_i_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME));
checkReport("""
+ Test DYD
Model BBM_PS instantiation successful
Model BBM_PSB instantiation successful
'phaseShifterId' field is not set
Model BBM_PSB2 cannot be instantiated
+ Dynawaltz models processing
PhaseShifterBlockingI BBM_PSB equipment WRONG_ID is not a PhaseShifterIModel, the automation system will be skipped
""");
Expand Down

0 comments on commit 0db29de

Please sign in to comment.