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) {
168
168
return tPrivate ;
169
169
}
170
170
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
+
171
184
/**
172
185
* Create Private of given type as parameter
173
186
* @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() {
211
211
new TCompasSystemVersion ());
212
212
}
213
213
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
+
214
226
@ Test
215
227
void removePrivates_should_remove_privates () {
216
228
// Given : setUp
You can’t perform that action at this time.
0 commit comments