BAEL-6223 : ul (CONFIGURATION)

Anonymous test methods naming
This commit is contained in:
ch4mpy 2023-03-01 14:53:01 -10:00
parent 5679db5cb8
commit 052dd5e64f
8 changed files with 22 additions and 22 deletions

View File

@ -38,7 +38,7 @@ class MessageServiceUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGreet_thenThrowsClassCastException() { void givenUserIsAnonymous_whenGreet_thenThrowsClassCastException() {
assertThrows(ClassCastException.class, () -> messageService.greet() assertThrows(ClassCastException.class, () -> messageService.greet()
.block()); .block());
} }
@ -64,7 +64,7 @@ class MessageServiceUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGetSecret_thenThrowsAccessDeniedException() { void givenUserIsAnonymous_whenGetSecret_thenThrowsAccessDeniedException() {
assertThrows(AccessDeniedException.class, () -> messageService.getSecret() assertThrows(AccessDeniedException.class, () -> messageService.getSecret()
.block()); .block());
} }

View File

@ -24,7 +24,7 @@ class ReactiveResourceServerApplicationIntegrationTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception {
api.get() api.get()
.uri("/greet") .uri("/greet")
.exchange() .exchange()
@ -51,7 +51,7 @@ class ReactiveResourceServerApplicationIntegrationTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception {
api.get() api.get()
.uri("/secured-route") .uri("/secured-route")
.exchange() .exchange()
@ -88,7 +88,7 @@ class ReactiveResourceServerApplicationIntegrationTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception {
api.get() api.get()
.uri("/secured-method") .uri("/secured-method")
.exchange() .exchange()

View File

@ -34,7 +34,7 @@ class SpringAddonsGreetingControllerUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception {
api.get() api.get()
.uri("/greet") .uri("/greet")
.exchange() .exchange()
@ -66,7 +66,7 @@ class SpringAddonsGreetingControllerUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception {
api.get() api.get()
.uri("/secured-route") .uri("/secured-route")
.exchange() .exchange()
@ -106,7 +106,7 @@ class SpringAddonsGreetingControllerUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception {
api.get() api.get()
.uri("/secured-method") .uri("/secured-method")
.exchange() .exchange()

View File

@ -39,7 +39,7 @@ class SpringSecurityTestGreetingControllerUnitTest {
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
@Test @Test
void givenUserIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception {
api.mutateWith(mockAuthentication(ANONYMOUS_AUTHENTICATION)) api.mutateWith(mockAuthentication(ANONYMOUS_AUTHENTICATION))
.get() .get()
.uri("/greet") .uri("/greet")
@ -72,7 +72,7 @@ class SpringSecurityTestGreetingControllerUnitTest {
/*---------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------*/
@Test @Test
void givenUserIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception {
api.mutateWith(mockAuthentication(ANONYMOUS_AUTHENTICATION)) api.mutateWith(mockAuthentication(ANONYMOUS_AUTHENTICATION))
.get() .get()
.uri("/secured-route") .uri("/secured-route")
@ -112,7 +112,7 @@ class SpringSecurityTestGreetingControllerUnitTest {
/*---------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------*/
@Test @Test
void givenUserIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception {
api.mutateWith(mockAuthentication(ANONYMOUS_AUTHENTICATION)) api.mutateWith(mockAuthentication(ANONYMOUS_AUTHENTICATION))
.get() .get()
.uri("/secured-method") .uri("/secured-method")

View File

@ -37,7 +37,7 @@ class MessageServiceUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGreet_thenThrowsAccessDeniedException() { void givenUserIsAnonymous_whenGreet_thenThrowsAccessDeniedException() {
assertThrows(AccessDeniedException.class, () -> messageService.getSecret()); assertThrows(AccessDeniedException.class, () -> messageService.getSecret());
} }
@ -60,7 +60,7 @@ class MessageServiceUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGetSecret_thenThrowsAccessDeniedException() { void givenUserIsAnonymous_whenGetSecret_thenThrowsAccessDeniedException() {
assertThrows(AccessDeniedException.class, () -> messageService.getSecret()); assertThrows(AccessDeniedException.class, () -> messageService.getSecret());
} }

View File

@ -28,7 +28,7 @@ class ServletResourceServerApplicationIntegrationTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGetGreet_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception {
api.perform(get("/greet")) api.perform(get("/greet"))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }
@ -48,7 +48,7 @@ class ServletResourceServerApplicationIntegrationTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGetSecuredRoute_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception {
api.perform(get("/secured-route")) api.perform(get("/secured-route"))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }
@ -75,7 +75,7 @@ class ServletResourceServerApplicationIntegrationTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGetSecuredMethod_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception {
api.perform(get("/secured-method")) api.perform(get("/secured-method"))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }

View File

@ -35,7 +35,7 @@ class SpringAddonsGreetingControllerUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGetGreet_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception {
api.perform(get("/greet")) api.perform(get("/greet"))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }
@ -60,7 +60,7 @@ class SpringAddonsGreetingControllerUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGetSecuredRoute_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception {
api.perform(get("/secured-route")) api.perform(get("/secured-route"))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }
@ -90,7 +90,7 @@ class SpringAddonsGreetingControllerUnitTest {
@Test @Test
@WithAnonymousUser @WithAnonymousUser
void givenUserIsNotAuthenticated_whenGetSecuredMethod_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception {
api.perform(get("/secured-method")) api.perform(get("/secured-method"))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }

View File

@ -37,7 +37,7 @@ class SpringSecurityTestGreetingControllerUnitTest {
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
@Test @Test
void givenUserIsNotAuthenticated_whenGetGreet_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetGreet_thenUnauthorized() throws Exception {
api.perform(get("/greet").with(anonymous())) api.perform(get("/greet").with(anonymous()))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }
@ -61,7 +61,7 @@ class SpringSecurityTestGreetingControllerUnitTest {
/*---------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------*/
@Test @Test
void givenUserIsNotAuthenticated_whenGetSecuredRoute_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredRoute_thenUnauthorized() throws Exception {
api.perform(get("/secured-route").with(anonymous())) api.perform(get("/secured-route").with(anonymous()))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }
@ -88,7 +88,7 @@ class SpringSecurityTestGreetingControllerUnitTest {
/*---------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------*/
@Test @Test
void givenUserIsNotAuthenticated_whenGetSecuredMethod_thenUnauthorized() throws Exception { void givenRequestIsAnonymous_whenGetSecuredMethod_thenUnauthorized() throws Exception {
api.perform(get("/secured-method").with(anonymous())) api.perform(get("/secured-method").with(anonymous()))
.andExpect(status().isUnauthorized()); .andExpect(status().isUnauthorized());
} }