38
38
@ TestSecurity (user = "test-editor" , roles = {"SCD_" + READ_ROLE , "SCD_" + CREATE_ROLE , "SCD_" + UPDATE_ROLE , "SCD_" + DELETE_ROLE })
39
39
@ JwtSecurity (claims = {
40
40
// Default the claim "name" is configured for Who, so we will set this claim for the test.
41
- @ Claim (key = "name" , value = "Test Editor" )
41
+ @ Claim (key = "name" , value = CompasSclDataResourceAsEditorTest . USERNAME )
42
42
})
43
43
class CompasSclDataResourceAsEditorTest {
44
+ public static final String USERNAME = "Test Editor" ;
45
+
44
46
@ InjectMock
45
47
private CompasSclDataService compasSclDataService ;
46
48
@@ -207,7 +209,7 @@ void create_WhenCalled_ThenServiceCalledAndUUIDRetrieved() {
207
209
request .setElements (new ArrayList <>());
208
210
request .getElements ().add (scl );
209
211
210
- when (compasSclDataService .create (eq (type ), eq (name ), eq ("Test Editor" ), eq (comment ), any (Element .class ))).thenReturn (uuid );
212
+ when (compasSclDataService .create (eq (type ), eq (name ), eq (USERNAME ), eq (comment ), any (Element .class ))).thenReturn (uuid );
211
213
212
214
var response = given ()
213
215
.pathParam (TYPE_PATH_PARAM , type )
@@ -220,7 +222,7 @@ void create_WhenCalled_ThenServiceCalledAndUUIDRetrieved() {
220
222
.response ();
221
223
222
224
assertEquals (uuid .toString (), response .xmlPath ().getString ("CreateResponse.Id" ));
223
- verify (compasSclDataService , times (1 )).create (eq (type ), eq (name ), eq ("Test Editor" ), eq (comment ), any (Element .class ));
225
+ verify (compasSclDataService , times (1 )).create (eq (type ), eq (name ), eq (USERNAME ), eq (comment ), any (Element .class ));
224
226
}
225
227
226
228
@ Test
@@ -237,7 +239,7 @@ void update_WhenCalled_ThenServiceCalledAndNewUUIDRetrieved() {
237
239
request .setElements (new ArrayList <>());
238
240
request .getElements ().add (scl );
239
241
240
- doNothing ().when (compasSclDataService ).update (eq (type ), eq (uuid ), eq (changeSetType ), eq ("Test Editor" ), eq (comment ), any (Element .class ));
242
+ doNothing ().when (compasSclDataService ).update (eq (type ), eq (uuid ), eq (changeSetType ), eq (USERNAME ), eq (comment ), any (Element .class ));
241
243
242
244
given ()
243
245
.pathParam (TYPE_PATH_PARAM , type )
@@ -248,7 +250,7 @@ void update_WhenCalled_ThenServiceCalledAndNewUUIDRetrieved() {
248
250
.then ()
249
251
.statusCode (204 );
250
252
251
- verify (compasSclDataService , times (1 )).update (eq (type ), eq (uuid ), eq (changeSetType ), eq ("Test Editor" ), eq (comment ), any (Element .class ));
253
+ verify (compasSclDataService , times (1 )).update (eq (type ), eq (uuid ), eq (changeSetType ), eq (USERNAME ), eq (comment ), any (Element .class ));
252
254
}
253
255
254
256
@ Test
0 commit comments