-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix maxStrategy() implementation to handle ALL_COLLECTIONS_NEEDED_FOR…
…_BUS_VIEW strategy (#497) Signed-off-by: BOUHOURS Antoine <[email protected]>
- Loading branch information
1 parent
6928386
commit 7fc7663
Showing
3 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/test/java/org/gridsuite/modification/server/ModificationTypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
Copyright (c) 2024, RTE (http://www.rte-france.com) | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.gridsuite.modification.server; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* @author Antoine Bouhours <antoine.bouhours at rte-france.com> | ||
*/ | ||
public class ModificationTypeTest { | ||
@Test | ||
public void testMaxStrategyNoneVsNone() { | ||
ModificationType noneStrategy1 = ModificationType.LOAD_CREATION; | ||
ModificationType noneStrategy2 = ModificationType.LOAD_MODIFICATION; | ||
assertEquals(noneStrategy1, noneStrategy1.maxStrategy(noneStrategy2)); | ||
assertEquals(noneStrategy2, noneStrategy2.maxStrategy(noneStrategy1)); | ||
} | ||
|
||
@Test | ||
public void testMaxStrategyNoneVsCollection() { | ||
ModificationType noneStrategy = ModificationType.LOAD_CREATION; | ||
ModificationType collectionStrategy = ModificationType.TABULAR_MODIFICATION; | ||
assertEquals(collectionStrategy, noneStrategy.maxStrategy(collectionStrategy)); | ||
assertEquals(collectionStrategy, collectionStrategy.maxStrategy(noneStrategy)); | ||
} | ||
|
||
@Test | ||
public void testMaxStrategyNoneVsAllCollectionsNeededForBusView() { | ||
ModificationType noneStrategy = ModificationType.LOAD_CREATION; | ||
ModificationType allCollectionsNeededForBusViewStrategy = ModificationType.VOLTAGE_INIT_MODIFICATION; | ||
assertEquals(allCollectionsNeededForBusViewStrategy, noneStrategy.maxStrategy(allCollectionsNeededForBusViewStrategy)); | ||
assertEquals(allCollectionsNeededForBusViewStrategy, allCollectionsNeededForBusViewStrategy.maxStrategy(noneStrategy)); | ||
} | ||
|
||
@Test | ||
public void testMaxStrategyCollectionVsCollection() { | ||
ModificationType collectionStrategy1 = ModificationType.TABULAR_MODIFICATION; | ||
ModificationType collectionStrategy2 = ModificationType.TABULAR_CREATION; | ||
assertEquals(collectionStrategy1, collectionStrategy1.maxStrategy(collectionStrategy2)); | ||
assertEquals(collectionStrategy2, collectionStrategy2.maxStrategy(collectionStrategy1)); | ||
} | ||
|
||
@Test | ||
public void testMaxStrategyCollectionVsAllCollectionsNeededForBusView() { | ||
ModificationType collectionStrategy = ModificationType.TABULAR_MODIFICATION; | ||
ModificationType allCollectionsNeededForBusViewStrategy = ModificationType.VOLTAGE_INIT_MODIFICATION; | ||
assertEquals(allCollectionsNeededForBusViewStrategy, collectionStrategy.maxStrategy(allCollectionsNeededForBusViewStrategy)); | ||
assertEquals(allCollectionsNeededForBusViewStrategy, allCollectionsNeededForBusViewStrategy.maxStrategy(collectionStrategy)); | ||
} | ||
} |