Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test on voltage level detail display #621

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

So-Fras
Copy link
Member

@So-Fras So-Fras commented Jun 14, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines

What kind of change does this PR introduce?
Bug fix

What is the current behavior?
In the TextNodeTest class, the custom getLabelProvider function, defined in the TextNodeTest class returns the labelProvider variable if this variable is not null or a customized LabelProvider if the labelProvider variable is null :

    protected LabelProvider getLabelProvider(Network network) {
        if (labelProvider != null) {
            return labelProvider;
        }
        return new DefaultLabelProvider(network, getSvgParameters()) {
            @Override
            public List<String> getVoltageLevelDetails(VoltageLevelNode vlNode) {
                VoltageLevel vl = network.getVoltageLevel(vlNode.getEquipmentId());
                return List.of(
                        vl.getLoadCount() + " loads",
                        vl.getGeneratorCount() + " generators",
                        vl.getBatteryCount() + " batteries",
                        vl.getDanglingLineCount() + " dangling lines");
            }
        };
    }

In the TextNodeTest > testSubstationDescriptiontest, the labelProvider variable was instantiated with a new DefaultLabelProvider(...) and thus not null.

Because of that, the customized LabelProvider, with its customized getVoltageLevelDetails method is not used.
It seems like it should be, in order to test the setVoltageLevelDetails(true) configuration.

What is the new behavior (if this is a feature change)?
The instantiation of the labelProvider variable is removed so that the customized LabelProvider is used.
The test resource file is modified (voltage level details now appear in the text box).

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Copy link

sonarcloud bot commented Jun 19, 2024

@flo-dup flo-dup merged commit 9988566 into main Jun 19, 2024
7 checks passed
@flo-dup flo-dup deleted the voltage_level_detail_test_fix branch June 19, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants