From 29719593ff6b5c3666f91c2b48e5e70a522133e2 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Fri, 23 Aug 2024 22:48:25 -0300 Subject: [PATCH] fix --- .../security/jwt/TestAuthenticationResource.java.ejs | 3 ++- .../java/_package_/web/rest/AccountResourceIT.java.ejs | 8 ++++---- .../_package_/web/rest/AccountResourceIT_oauth2.java.ejs | 8 ++++---- .../rest/AccountResourceIT_skipUserManagement.java.ejs | 8 ++++---- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/generators/spring-boot/templates/src/test/java/_package_/security/jwt/TestAuthenticationResource.java.ejs b/generators/spring-boot/templates/src/test/java/_package_/security/jwt/TestAuthenticationResource.java.ejs index c3aed5b1f010..dd79577de29e 100644 --- a/generators/spring-boot/templates/src/test/java/_package_/security/jwt/TestAuthenticationResource.java.ejs +++ b/generators/spring-boot/templates/src/test/java/_package_/security/jwt/TestAuthenticationResource.java.ejs @@ -1,5 +1,6 @@ package <%= packageName %>.security.jwt; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; /** @@ -14,7 +15,7 @@ public class TestAuthenticationResource { * * @return ok. */ - @GetMapping("/authenticate") + @GetMapping(value = "/authenticate", produces = MediaType.TEXT_PLAIN_VALUE) public String isAuthenticated() { return "ok"; } diff --git a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs index 93e86dab598c..41a763744ec4 100644 --- a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs +++ b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs @@ -174,14 +174,14 @@ class AccountResourceIT { <%_ if (reactive) { _%> void testNonAuthenticatedUser() { accountWebTestClient.get().uri("/api/authenticate") - .accept(MediaType.TEXT_PLAIN_VALUE) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody().isEmpty(); <%_ } else { _%> void testNonAuthenticatedUser() throws Exception { restAccountMockMvc - .perform(get("/api/authenticate").accept(MediaType.TEXT_PLAIN_VALUE)) + .perform(get("/api/authenticate").accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string("")); <%_ } _%> @@ -193,14 +193,14 @@ class AccountResourceIT { void testAuthenticatedUser() { accountWebTestClient .get().uri("/api/authenticate") - .accept(MediaType.TEXT_PLAIN_VALUE) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody(String.class).isEqualTo(TEST_USER_LOGIN); <%_ } else { _%> void testAuthenticatedUser() throws Exception { restAccountMockMvc - .perform(get("/api/authenticate").with(request -> request).accept(MediaType.TEXT_PLAIN_VALUE)) + .perform(get("/api/authenticate").with(request -> request).accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string(TEST_USER_LOGIN)); <%_ } _%> diff --git a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs index dd8a55073a87..805b52fcbb30 100644 --- a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs +++ b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs @@ -185,13 +185,13 @@ class AccountResourceIT { void testNonAuthenticatedUser() <% if (!reactive) { %>throws Exception <% } %>{ <%_ if (reactive) { _%> webTestClient.get().uri("/api/authenticate") - .accept(MediaType.TEXT_PLAIN_VALUE) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody().isEmpty(); <%_ } else { _%> restAccountMockMvc.perform(get("/api/authenticate") - .accept(MediaType.TEXT_PLAIN_VALUE)) + .accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string("")); <%_ } _%> @@ -203,14 +203,14 @@ class AccountResourceIT { <%_ if (reactive) { _%> webTestClient .get().uri("/api/authenticate") - .accept(MediaType.TEXT_PLAIN_VALUE) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody(String.class).isEqualTo(TEST_USER_LOGIN); <%_ } else { _%> restAccountMockMvc.perform(get("/api/authenticate") .with(request -> request) - .accept(MediaType.TEXT_PLAIN_VALUE)) + .accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string(TEST_USER_LOGIN)); <%_ } _%> diff --git a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_skipUserManagement.java.ejs b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_skipUserManagement.java.ejs index 6b4080e9fb27..46ccb1c54867 100644 --- a/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_skipUserManagement.java.ejs +++ b/generators/spring-boot/templates/src/test/java/_package_/web/rest/AccountResourceIT_skipUserManagement.java.ejs @@ -116,13 +116,13 @@ class AccountResourceIT { void testNonAuthenticatedUser() <% if (!reactive) { %>throws Exception <% } %>{ <%_ if (reactive) { _%> accountWebTestClient.get().uri("/api/authenticate") - .accept(MediaType.TEXT_PLAIN_VALUE) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody().isEmpty(); <%_ } else { _%> restAccountMockMvc.perform(get("/api/authenticate") - .accept(MediaType.TEXT_PLAIN_VALUE)) + .accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string("")); <%_ } _%> @@ -134,14 +134,14 @@ class AccountResourceIT { <%_ if (reactive) { _%> accountWebTestClient .get().uri("/api/authenticate") - .accept(MediaType.TEXT_PLAIN_VALUE) + .accept(MediaType.TEXT_PLAIN) .exchange() .expectStatus().isOk() .expectBody(String.class).isEqualTo(TEST_USER_LOGIN); <%_ } else { _%> restAccountMockMvc.perform(get("/api/authenticate") .with(request -> request) - .accept(MediaType.TEXT_PLAIN_VALUE)) + .accept(MediaType.TEXT_PLAIN)) .andExpect(status().isOk()) .andExpect(content().string(TEST_USER_LOGIN)); <%_ } _%>