Fix new line after @Test (#2486)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-06-20 17:42:55 +03:00
committed by GitHub
parent cb7f1107fe
commit ef25aa59f0
152 changed files with 2948 additions and 1474 deletions

View File

@@ -29,21 +29,24 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
/**
* Tests whether a RequestRejectedException is thrown when not allowed host is used
*/
@Test void allowedHostNameWithNotAllowedHost() throws Exception {
@Test
void allowedHostNameWithNotAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "www.google.com")).andExpect(status().isBadRequest());
}
/**
* Tests whether request is redirected when allowed host is used
*/
@Test void allowedHostNameWithAllowedHost() throws Exception {
@Test
void allowedHostNameWithAllowedHost() throws Exception {
mvc.perform(get("/").header(HttpHeaders.HOST, "localhost")).andExpect(status().is3xxRedirection());
}
/**
* Tests whether request without allowed host name and with ignored path end up with a client error
*/
@Test void notAllowedHostnameWithIgnoredPath() throws Exception {
@Test
void notAllowedHostnameWithIgnoredPath() throws Exception {
mvc.perform(get("/index.html").header(HttpHeaders.HOST, "www.google.com"))
.andExpect(status().is4xxClientError());
}

View File

@@ -46,7 +46,8 @@ class CorsTest extends AbstractSecurityTest {
/**
* Ensures that Cors is working.
*/
@Test @WithUser(authorities = SpRole.TENANT_ADMIN, autoCreateTenant = false)
@Test
@WithUser(authorities = SpRole.TENANT_ADMIN, autoCreateTenant = false)
void validateCorsRequest() throws Exception {
performOptionsRequestToRestWithOrigin(ALLOWED_ORIGIN_FIRST).andExpect(status().isOk())
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, ALLOWED_ORIGIN_FIRST));

View File

@@ -30,7 +30,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request fail if a role is forbidden for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
void failIfNoRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.FORBIDDEN.value()));
@@ -39,7 +40,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request succeed if a role is granted for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_REPOSITORY }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_REPOSITORY }, autoCreateTenant = false)
void successIfHasRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
@@ -48,7 +50,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether request succeed if a role is granted for the user
*/
@Test @WithUser(authorities = { SpRole.TENANT_ADMIN }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpRole.TENANT_ADMIN }, autoCreateTenant = false)
void successIfHasTenantAdminRole() throws Exception {
mvc.perform(get("/rest/v1/distributionsets"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
@@ -57,7 +60,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether read tenant config request fail if a tenant config (or read read) is not granted for the user
*/
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
void onlyDSIfNoTenantConfig() throws Exception {
mvc.perform(get("/rest/v1/system/configs"))
.andExpect(result -> {
@@ -71,7 +75,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
/**
* Tests whether read tenant config request succeed if a tenant config (not read explicitly) is granted for the user
*/
@Test @WithUser(authorities = { SpPermission.TENANT_CONFIGURATION }, autoCreateTenant = false)
@Test
@WithUser(authorities = { SpPermission.TENANT_CONFIGURATION }, autoCreateTenant = false)
void successIfHasTenantConfig() throws Exception {
mvc.perform(get("/rest/v1/system/configs"))
.andExpect(result -> assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));