-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
61 additions
and
12 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
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
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
36 changes: 36 additions & 0 deletions
36
src/test/java/com/connectedcooking/opcua/dynamicnodemanager/core/DynNodeManagerTest.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,36 @@ | ||
package com.connectedcooking.opcua.dynamicnodemanager.core; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
class DynNodeManagerTest { | ||
|
||
@Test | ||
void multipleAssignedChildrenSet() { | ||
var parent = new RealNodeId("Parent"); | ||
var dynNode1 = new DynNodeId("DynNodeA_<No.>"); | ||
var dynNode2 = new DynNodeId("DynNodeB_<No.>"); | ||
|
||
var dnm = new DynNodeManager(); | ||
|
||
dnm.assignSet(parent, dynNode1, (ctx, nodeId) -> List.of( | ||
new RealNodeId("DynNodeA_1"))); | ||
|
||
dnm.assignSet(parent, dynNode2, (ctx, nodeId) -> List.of( | ||
new RealNodeId("DynNodeB_1"), new RealNodeId("DynNodeB_2"))); | ||
|
||
var references = dnm.assignedChildren(parent, null).stream() | ||
.map(DynReference::targetId) | ||
.map(RealNodeId::identifier) | ||
.collect(Collectors.toList()); | ||
|
||
assertThat(references).containsExactlyInAnyOrder("DynNodeA_1", "DynNodeB_1", "DynNodeB_2"); | ||
} | ||
} |