Refactor some TAPI Junit tests code 02/110102/2
authorguillaume.lambert <guillaume.lambert@orange.com>
Wed, 31 Jan 2024 11:47:59 +0000 (12:47 +0100)
committerGuillaume Lambert <guillaume.lambert@orange.com>
Tue, 6 Feb 2024 19:50:06 +0000 (19:50 +0000)
JIRA: TRNSPRTPCE:758
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I49fe0a517fd7c57616ddd32697cd4ab8fd931085

tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java

index a01165d7d26c0a2491763ae31ad250db5be3fbf2..0c371e95de83d10b88e5c7ed3eb29bfd952a1367 100644 (file)
@@ -1298,28 +1298,19 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest {
 
     private Integer nrgContainsClientAndNetwork(List<NodeRuleGroup> nrgList, Uuid clientNepUuid, Uuid networkNepUuid) {
         // 1 NRG should at least contain the NEP of interest in the NEP List
-        Boolean foundClient = false;
-        Boolean foundNetwork = false;
         Integer indexNrg = 0;
         for (NodeRuleGroup nrg : nrgList) {
+            Boolean foundClient = false;
+            Boolean foundNetwork = false;
             for (NodeEdgePoint nep : nrg.nonnullNodeEdgePoint().values()) {
-                if (nep.getNodeEdgePointUuid().equals(clientNepUuid)) {
-                    foundClient = true;
-                } else if (nep.getNodeEdgePointUuid().equals(networkNepUuid)) {
-                    foundNetwork = true;
-                }
+                foundClient = foundClient || nep.getNodeEdgePointUuid().equals(clientNepUuid);
+                foundNetwork = foundNetwork || nep.getNodeEdgePointUuid().equals(networkNepUuid);
             }
             if (foundClient && foundNetwork) {
-                break;
-            } else {
-                foundClient = false;
-                foundNetwork = false;
+                return indexNrg;
             }
             indexNrg++;
         }
-        if (foundClient && foundNetwork) {
-            return indexNrg;
-        }
         return null;
     }