Polish formatting

This commit is contained in:
Phillip Webb
2016-12-19 12:37:54 -08:00
parent 4b9cba351b
commit 6121208cbb
46 changed files with 110 additions and 88 deletions

View File

@@ -346,8 +346,8 @@ public class CrshAutoConfigurationTests {
&& authentication.getCredentials().equals(PASSWORD)) {
authentication = new UsernamePasswordAuthenticationToken(
authentication.getPrincipal(),
authentication.getCredentials(), Collections
.singleton(new SimpleGrantedAuthority("ACTUATOR")));
authentication.getCredentials(), Collections.singleton(
new SimpleGrantedAuthority("ACTUATOR")));
}
else {
throw new BadCredentialsException(

View File

@@ -269,8 +269,8 @@ public class EndpointMBeanExporterTests {
MBeanExporter mbeanExporter = registerLoggersEndpoint();
Object response = mbeanExporter.getServer().invoke(
getObjectName("loggersEndpoint", this.context), "setLogLevel",
new Object[]{"com.example", "trace"},
new String[]{String.class.getName(), String.class.getName()});
new Object[] { "com.example", "trace" },
new String[] { String.class.getName(), String.class.getName() });
assertThat(response).isNull();
}
@@ -280,10 +280,9 @@ public class EndpointMBeanExporterTests {
this.thrown.expect(MBeanException.class);
this.thrown.expectCause(hasMessage(containsString("No enum constant")));
this.thrown.expectCause(hasMessage(containsString("LogLevel.INVALID")));
mbeanExporter.getServer().invoke(
getObjectName("loggersEndpoint", this.context), "setLogLevel",
new Object[]{"com.example", "invalid"},
new String[]{String.class.getName(), String.class.getName()});
mbeanExporter.getServer().invoke(getObjectName("loggersEndpoint", this.context),
"setLogLevel", new Object[] { "com.example", "invalid" },
new String[] { String.class.getName(), String.class.getName() });
}
private MBeanExporter registerLoggersEndpoint() {

View File

@@ -109,6 +109,7 @@ public class MvcEndpointsTests {
TestMvcEndpoint(Endpoint<?> delegate) {
super(delegate);
}
}
private static class OtherTestMvcEndpoint extends EndpointMvcAdapter {
@@ -116,6 +117,7 @@ public class MvcEndpointsTests {
OtherTestMvcEndpoint(Endpoint<?> delegate) {
super(delegate);
}
}
}

View File

@@ -86,8 +86,8 @@ public class AuthenticationAuditListenerTests {
AuditApplicationEvent event = handleAuthenticationEvent(
new AuthenticationSwitchUserEvent(
new UsernamePasswordAuthenticationToken("user", "password"),
new User("user", "password",
AuthorityUtils.commaSeparatedStringToAuthorityList("USER"))));
new User("user", "password", AuthorityUtils
.commaSeparatedStringToAuthorityList("USER"))));
assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_SWITCH);
}
@@ -98,12 +98,12 @@ public class AuthenticationAuditListenerTests {
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
"user", "password");
authentication.setDetails(details);
AuditApplicationEvent event = handleAuthenticationEvent(new AuthenticationFailureExpiredEvent(
authentication, new BadCredentialsException("Bad user")));
AuditApplicationEvent event = handleAuthenticationEvent(
new AuthenticationFailureExpiredEvent(authentication,
new BadCredentialsException("Bad user")));
assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
assertThat(event.getAuditEvent().getData())
.containsEntry("details", details);
assertThat(event.getAuditEvent().getData()).containsEntry("details", details);
}
private AuditApplicationEvent handleAuthenticationEvent(

View File

@@ -56,7 +56,8 @@ public class AuthorizationAuditListenerTests {
public void testAuthenticationCredentialsNotFound() {
AuditApplicationEvent event = handleAuthorizationEvent(
new AuthenticationCredentialsNotFoundEvent(this,
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
new AuthenticationCredentialsNotFoundException("Bad user")));
assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
@@ -66,7 +67,8 @@ public class AuthorizationAuditListenerTests {
public void testAuthorizationFailure() {
AuditApplicationEvent event = handleAuthorizationEvent(
new AuthorizationFailureEvent(this,
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
new UsernamePasswordAuthenticationToken("user", "password"),
new AccessDeniedException("Bad user")));
assertThat(event.getAuditEvent().getType())
@@ -81,7 +83,8 @@ public class AuthorizationAuditListenerTests {
authentication.setDetails(details);
AuditApplicationEvent event = handleAuthorizationEvent(
new AuthorizationFailureEvent(this,
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
Collections.<ConfigAttribute>singletonList(
new SecurityConfig("USER")),
authentication, new AccessDeniedException("Bad user")));
assertThat(event.getAuditEvent().getType())
.isEqualTo(AuthorizationAuditListener.AUTHORIZATION_FAILURE);