From: guillaume.lambert Date: Wed, 31 Jan 2024 11:47:59 +0000 (+0100) Subject: Refactor some TAPI Junit tests code X-Git-Tag: 9.0.0~53 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=4e9b7568daca3fcf26a40d07626b51ba872050b1;hp=0e4f5df18fc951c1525e5ba9098f037788a23367;p=transportpce.git Refactor some TAPI Junit tests code JIRA: TRNSPRTPCE:758 Signed-off-by: guillaume.lambert Change-Id: I49fe0a517fd7c57616ddd32697cd4ab8fd931085 --- diff --git a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java index a01165d7d..0c371e95d 100644 --- a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java +++ b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToFullTapiTopoTest.java @@ -1298,28 +1298,19 @@ public class ConvertORTopoToFullTapiTopoTest extends AbstractTest { private Integer nrgContainsClientAndNetwork(List 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; }