Skip to content

Commit

Permalink
Merge pull request #10637 from qmonmert/prettier220824
Browse files Browse the repository at this point in the history
Prettier: Format some files
  • Loading branch information
murdos authored Aug 22, 2024
2 parents abd3daa + 252e7a3 commit cb76699
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ public class AuthenticationSteps {

@SuppressWarnings("java:S1144")
private String token() {
return Jwts
.builder()
return Jwts.builder()
.subject("authentication")
.signWith(CucumberAuthenticationConfiguration.JWT_KEY)
.claims(claims)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ import {{packageName}}.cucumber.rest.CucumberRestTemplate;

@ActiveProfiles("test")
@CucumberContextConfiguration
@SpringBootTest(classes = { {{ baseName }}App.class, CucumberRestTemplateConfiguration.class }, webEnvironment = WebEnvironment.RANDOM_PORT)
@SpringBootTest(
classes = {
{{ baseName }}App.class,
CucumberRestTemplateConfiguration.class
},
webEnvironment = WebEnvironment.RANDOM_PORT
)
public class CucumberConfiguration {
@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ public class TestMongoDBManager implements ApplicationListener<ApplicationEnviro
return;
}

mongoDbContainer =
new MongoDBContainer(DockerImageName.parse("{{mongodbDockerImage}}"))
.withTmpFs(Collections.singletonMap("/testtmpfs", "rw"))
.withLogConsumer(new Slf4jLogConsumer(log))
.withReuse(true);
mongoDbContainer = new MongoDBContainer(DockerImageName.parse("{{mongodbDockerImage}}"))
.withTmpFs(Collections.singletonMap("/testtmpfs", "rw"))
.withLogConsumer(new Slf4jLogConsumer(log))
.withReuse(true);

mongoDbContainer.start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class {{ baseName }}ExceptionTest {

@Test
void shouldGetInternalServerErrorShortcut() {
{{ baseName }}Exception exception = {{ baseName }}Exception.internalServerError(StandardErrorKey.INTERNAL_SERVER_ERROR).build();
{{ baseName }}Exception exception = {{ baseName }}Exception.internalServerError(
StandardErrorKey.INTERNAL_SERVER_ERROR
).build();

assertThat(exception.status()).isEqualTo(ErrorStatus.INTERNAL_SERVER_ERROR);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import {{packageName}}.shared.authentication.domain.Role;

public final class AccountsFixture {
private AccountsFixture() {
}
private AccountsFixture() {}

public static Account account() {
return Account.builder()
.username(username())
.firstname(firstname())
.lastname(lastname())
.email(email())
.roles(List.of(Role.ADMIN.key()))
.build();
.username(username())
.firstname(firstname())
.lastname(lastname())
.email(email())
.roles(List.of(Role.ADMIN.key()))
.build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ class RestAccountTest {
}\
""";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ class AuthenticatedUserTest {
}

private static JwtAuthenticationToken jwtAuthenticationToken() {
Jwt jwt = Jwt
.withTokenValue("token")
Jwt jwt = Jwt.withTokenValue("token")
.header("alg", JwsAlgorithms.RS256)
.subject("jhipster")
.claim("preferred_username", "admin")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ class CustomClaimConverterTest {
}

private ResponseEntity<ObjectNode> assertNoRestClaimCall() {
return verify(rest, never())
.exchange(anyString(), eq(HttpMethod.GET), any(HttpEntity.class), ArgumentMatchers.<Class<ObjectNode>>any());
return verify(rest, never()).exchange(
anyString(),
eq(HttpMethod.GET),
any(HttpEntity.class),
ArgumentMatchers.<Class<ObjectNode>>any()
);
}

@Test
Expand Down Expand Up @@ -306,12 +310,14 @@ class CustomClaimConverterTest {
}

private void mockUser(ObjectNode user) {
when(rest.exchange(eq("http://jhipster.test"), eq(HttpMethod.GET), any(HttpEntity.class), ArgumentMatchers.<Class<ObjectNode>>any()))
.thenReturn(ResponseEntity.ok(user));
when(
rest.exchange(eq("http://jhipster.test"), eq(HttpMethod.GET), any(HttpEntity.class), ArgumentMatchers.<Class<ObjectNode>>any())
).thenReturn(ResponseEntity.ok(user));
}

private void mockRestTimeout() {
when(rest.exchange(eq("http://jhipster.test"), eq(HttpMethod.GET), any(HttpEntity.class), ArgumentMatchers.<Class<ObjectNode>>any()))
.thenThrow(new ResourceAccessException(null, new SocketTimeoutException()));
when(
rest.exchange(eq("http://jhipster.test"), eq(HttpMethod.GET), any(HttpEntity.class), ArgumentMatchers.<Class<ObjectNode>>any())
).thenThrow(new ResourceAccessException(null, new SocketTimeoutException()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class JwtGrantedAuthorityConverterTest {
@Test
void shouldConvert() {
Jwt jwt = Jwt
.withTokenValue("token")
Jwt jwt = Jwt.withTokenValue("token")
.header("alg", JwsAlgorithms.RS256)
.subject("jhipster")
.claim("roles", List.of("ROLE_ADMIN"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public class TestSecurityConfiguration {
Map<String, Object> metadata = new HashMap<>();
metadata.put("end_session_endpoint", "https://jhipster.org/logout");
return ClientRegistration
.withRegistrationId("oidc")
return ClientRegistration.withRegistrationId("oidc")
.issuerUri("{baseUrl}")
.redirectUri("{baseUrl}/{action}/oauth2/code/{registrationId}")
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)
Expand Down

0 comments on commit cb76699

Please sign in to comment.