Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Aug 24, 2024
1 parent 76c9ca5 commit 2971959
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package <%= packageName %>.security.jwt;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
Expand All @@ -14,7 +15,7 @@ public class TestAuthenticationResource {
*
* @return ok.
*/
@GetMapping("/authenticate")
@GetMapping(value = "/authenticate", produces = MediaType.TEXT_PLAIN_VALUE)
public String isAuthenticated() {
return "ok";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(""));
<%_ } _%>
Expand All @@ -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));
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(""));
<%_ } _%>
Expand All @@ -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));
<%_ } _%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(""));
<%_ } _%>
Expand All @@ -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));
<%_ } _%>
Expand Down

0 comments on commit 2971959

Please sign in to comment.