Skip to content

Commit

Permalink
Unit test fail
Browse files Browse the repository at this point in the history
  • Loading branch information
thangqp committed Sep 12, 2024
1 parent eba41e9 commit 5968284
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ protected String getOldValue(Identifiable<?> equipment, AbstractAssignmentInfos
@Override
protected String getNewValue(Identifiable<?> equipment, AbstractAssignmentInfos abstractAssignmentInfos) {
AssignmentInfos<?> simpleModificationInfos = (AssignmentInfos<?>) abstractAssignmentInfos;
if (simpleModificationInfos.getValue() == null) {
throw new NetworkModificationException(MODIFICATION_BY_ASSIGNMENT_ERROR, "There is no value in assignment");
}
return simpleModificationInfos.getValue().toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
import org.gridsuite.filter.identifierlistfilter.IdentifierListFilter;
import org.gridsuite.filter.identifierlistfilter.IdentifierListFilterEquipmentAttributes;
import org.gridsuite.filter.utils.EquipmentType;
import org.gridsuite.modification.server.dto.FilterInfos;
import org.gridsuite.modification.server.dto.byfilter.equipmentfield.GeneratorField;
import org.gridsuite.modification.server.dto.byfilter.assignment.AssignmentInfos;
import org.gridsuite.modification.server.dto.byfilter.assignment.BooleanAssignmentInfos;
import org.gridsuite.modification.server.dto.byfilter.assignment.DoubleAssignmentInfos;
import org.gridsuite.modification.server.dto.byfilter.equipmentfield.GeneratorField;
import org.junit.Test;
import org.junit.jupiter.api.Tag;

Expand Down Expand Up @@ -61,20 +60,6 @@ public void testCreateWithWarning() throws Exception {
assertEquals(55, getNetwork().getGenerator(GENERATOR_ID_1).getTargetP(), 0);
}

@Test
public void testWithNullValue() throws Exception {
IdentifierListFilterEquipmentAttributes identifiableAttributes = getIdentifiableAttributes(GENERATOR_ID_1, 1.0);
AbstractFilter filterEquipments = getFilterEquipments(FILTER_ID_1, List.of(identifiableAttributes));

DoubleAssignmentInfos simpleInfos = DoubleAssignmentInfos.builder()
.filters(List.of(new FilterInfos(FILTER_ID_1, "filter1")))
.editedField(GeneratorField.ACTIVE_POWER_SET_POINT.name())
.value(null)
.build();

checkCreateWithError(List.of(simpleInfos), List.of(filterEquipments));
}

protected void createEquipments() {
getNetwork().getGenerator(GENERATOR_ID_1)
.setTargetP(100)
Expand Down

0 comments on commit 5968284

Please sign in to comment.