Skip to content

Commit 1167ab8

Browse files
Merge pull request #410 from com-pas/feat/400-rsr-1034_Add-a-private-LNodeStatus-to-the-SSD-file
feat(400-rsr-1034): Add a private LNodeStatus to the SSD file
2 parents 5e68693 + ad2fed2 commit 1167ab8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/PrivateUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,19 @@ public static TPrivate createPrivate(List<TCompasTopo> compasTopos) {
168168
return tPrivate;
169169
}
170170

171+
/**
172+
* Create private of a given type containing a simple string as value
173+
* @param privateType type attribute of private element to create
174+
* @param privateValue value of private to create
175+
* @return the complete private
176+
*/
177+
public static TPrivate createStringPrivate(String privateType, String privateValue) {
178+
TPrivate tPrivate = new TPrivate();
179+
tPrivate.setType(privateType);
180+
tPrivate.getContent().add(privateValue);
181+
return tPrivate;
182+
}
183+
171184
/**
172185
* Create Private of given type as parameter
173186
* @param jaxbElement content of Private to create

sct-commons/src/test/java/org/lfenergy/compas/sct/commons/util/PrivateUtilsTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,18 @@ public static Stream<Object> createPrivateTestSources() {
211211
new TCompasSystemVersion());
212212
}
213213

214+
@Test
215+
void createStringPrivate_should_return_new_private() {
216+
//GIVEN
217+
String privateType = "COMPAS-LNodeStatus";
218+
String compasLNodeStatus = "on";
219+
//WHEN
220+
TPrivate result = PrivateUtils.createStringPrivate(privateType, compasLNodeStatus);
221+
//THEN
222+
assertThat(result.getType()).contains(privateType);
223+
assertThat(result.getContent()).containsExactly(compasLNodeStatus);
224+
}
225+
214226
@Test
215227
void removePrivates_should_remove_privates() {
216228
// Given : setUp

0 commit comments

Comments
 (0)