Skip to content

Commit a4a4709

Browse files
author
Slimane AMAR
committed
Fix test based on the order of a node's children
1 parent ad66f8f commit a4a4709

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -662,27 +662,27 @@ void testNodeManipulation() throws Exception {
662662
/* expected :
663663
root
664664
/ \
665-
node1 node2
665+
node1(hypo 1) node2(loadflow)
666666
*/
667667
assertChildrenEquals(Set.of(node1, node2), root.getChildren());
668668

669669
node2.setName("niark");
670670
node1.setName("condriak");
671671
node1.setModificationGroupUuid(UUID.randomUUID());
672-
createNode(root.getStudyId(), children.get(1), node2, userId);
673-
createNode(root.getStudyId(), children.get(1), node1, userId);
672+
AbstractNode child = children.get(0).getName().equals("loadflow") ? children.get(0) : children.get(1);
673+
createNode(root.getStudyId(), child, node2, userId);
674+
createNode(root.getStudyId(), child, node1, userId);
674675

675676
/* expected
676677
root
677678
/ \
678-
node1 node2
679+
node1 node2(loadflow)
679680
/ \
680681
node(condriak) node(niark)
681682
*/
682683

683684
root = getRootNode(root.getStudyId(), firstRootNetwork);
684-
AbstractNode child;
685-
if (root.getChildren().get(0).getName().equals(children.get(1).getName())) {
685+
if (root.getChildren().get(0).getName().equals(child.getName())) {
686686
child = root.getChildren().get(0);
687687
} else {
688688
child = root.getChildren().get(1);
@@ -693,23 +693,26 @@ void testNodeManipulation() throws Exception {
693693
deleteNode(root.getStudyId(), List.of(child), false, Set.of(child), true, userId);
694694

695695
/* expected
696-
root
697-
/ | \
698-
node node node
696+
root
697+
/ | \
698+
node node node
699+
(hypo 1) (condriak) (niark)
699700
*/
700701

701702
root = getRootNode(root.getStudyId(), firstRootNetwork);
702703
assertEquals(3, root.getChildren().size());
703704
child = root.getChildren().get(0);
705+
704706
createNode(root.getStudyId(), child, node4, userId);
705707

706708
deleteNode(root.getStudyId(), List.of(child), true, Set.of(child, node4), userId);
707709

708710
/* expected
709-
root
710-
|
711-
node
711+
root
712+
| \
713+
node node
712714
*/
715+
713716
root = getRootNode(root.getStudyId(), firstRootNetwork);
714717
assertEquals(2, root.getChildren().size());
715718
assertEquals(3, nodeRepository.findAll().size());

0 commit comments

Comments
 (0)