Skip to content

Commit d5365d0

Browse files
author
Christian
committed
Add NIST_ROLE mock to unit tests for role-based access validation
1 parent 1299c3b commit d5365d0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/test/java/com/ammann/entropy/resource/EntropyResourceTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ void triggerNist90BValidation_success_returns202() {
277277

278278
SecurityContext securityContext = mock(SecurityContext.class);
279279
when(securityContext.getUserPrincipal()).thenReturn(null);
280+
when(securityContext.isUserInRole("NIST_ROLE")).thenReturn(true);
280281

281282
var response =
282283
resource.triggerNIST90BValidation(
@@ -294,6 +295,7 @@ void triggerNist90BValidation_validationException_returns400() {
294295

295296
SecurityContext securityContext = mock(SecurityContext.class);
296297
when(securityContext.getUserPrincipal()).thenReturn(null);
298+
when(securityContext.isUserInRole("NIST_ROLE")).thenReturn(true);
297299

298300
var response =
299301
resource.triggerNIST90BValidation(

0 commit comments

Comments
 (0)