File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
main/java/org/lfenergy/compas/sct/commons/util
test/java/org/lfenergy/compas/sct/commons/util Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments