Remove superfluous comments
Use '^\s+//\ \~\ .*$' and '^\s+//\ ============+$' regular expression searches to remove superfluous comments. Prior to this commit, many classes would have comments to indicate blocks of code (such as constructors/methods/instance fields). These added a lot of noise and weren't all that helpful, especially given the outline views available in most modern IDEs. Issue gh-8945
This commit is contained in:
@@ -29,13 +29,8 @@ import javax.servlet.ServletContext;
|
||||
@SuppressWarnings("unchecked")
|
||||
public class MockFilterConfig implements FilterConfig {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
private Map map = new HashMap();
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public String getFilterName() {
|
||||
throw new UnsupportedOperationException("mock method not implemented");
|
||||
}
|
||||
|
||||
@@ -27,24 +27,15 @@ import javax.servlet.ServletRequest;
|
||||
*/
|
||||
public class MockPortResolver implements PortResolver {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private int http = 80;
|
||||
|
||||
private int https = 443;
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
public MockPortResolver(int http, int https) {
|
||||
this.http = http;
|
||||
this.https = https;
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public int getServerPort(ServletRequest request) {
|
||||
if ((request.getScheme() != null) && request.getScheme().equals("https")) {
|
||||
return https;
|
||||
|
||||
@@ -37,9 +37,6 @@ import org.springframework.security.web.util.UrlUtils;
|
||||
*/
|
||||
public class FilterInvocationTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void testGettersAndStringMethods() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest(null, null);
|
||||
|
||||
@@ -31,8 +31,6 @@ import org.junit.Test;
|
||||
*/
|
||||
public class PortMapperImplTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDefaultMappingsAreKnown() {
|
||||
PortMapperImpl portMapper = new PortMapperImpl();
|
||||
|
||||
@@ -29,8 +29,6 @@ import org.springframework.mock.web.MockHttpServletRequest;
|
||||
*/
|
||||
public class PortResolverImplTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDetectsBuggyIeHttpRequest() {
|
||||
PortResolverImpl pr = new PortResolverImpl();
|
||||
|
||||
@@ -48,9 +48,6 @@ public class DefaultWebInvocationPrivilegeEvaluatorTests {
|
||||
|
||||
private FilterSecurityInterceptor interceptor;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public final void setUp() {
|
||||
interceptor = new FilterSecurityInterceptor();
|
||||
|
||||
@@ -44,8 +44,6 @@ import static org.mockito.Mockito.mock;
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ChannelDecisionManagerImplTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testCannotSetEmptyChannelProcessorsList() throws Exception {
|
||||
ChannelDecisionManagerImpl cdm = new ChannelDecisionManagerImpl();
|
||||
@@ -190,9 +188,6 @@ public class ChannelDecisionManagerImplTests {
|
||||
}
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockChannelProcessor implements ChannelProcessor {
|
||||
|
||||
private String configAttribute;
|
||||
|
||||
@@ -39,9 +39,6 @@ import org.springframework.security.web.access.intercept.FilterInvocationSecurit
|
||||
*/
|
||||
public class ChannelProcessingFilterTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testDetectsMissingChannelDecisionManager() {
|
||||
ChannelProcessingFilter filter = new ChannelProcessingFilter();
|
||||
@@ -152,9 +149,6 @@ public class ChannelProcessingFilterTests {
|
||||
filter.afterPropertiesSet();
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockChannelDecisionManager implements ChannelDecisionManager {
|
||||
|
||||
private String supportAttribute;
|
||||
|
||||
@@ -40,8 +40,6 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
public class RetryWithHttpEntryPointTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDetectsMissingPortMapper() {
|
||||
RetryWithHttpEntryPoint ep = new RetryWithHttpEntryPoint();
|
||||
|
||||
@@ -36,8 +36,6 @@ import java.util.Map;
|
||||
*/
|
||||
public class RetryWithHttpsEntryPointTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDetectsMissingPortMapper() {
|
||||
RetryWithHttpsEntryPoint ep = new RetryWithHttpsEntryPoint();
|
||||
|
||||
@@ -35,8 +35,6 @@ import org.springframework.security.web.access.channel.SecureChannelProcessor;
|
||||
*/
|
||||
public class SecureChannelProcessorTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testDecideDetectsAcceptableChannel() throws Exception {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
@@ -45,8 +45,6 @@ public class DefaultFilterInvocationSecurityMetadataSourceTests {
|
||||
|
||||
private Collection<ConfigAttribute> def = SecurityConfig.createList("ROLE_ONE");
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
private void createFids(String pattern, String method) {
|
||||
LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();
|
||||
requestMap.put(new AntPathRequestMatcher(pattern, method), this.def);
|
||||
|
||||
@@ -62,9 +62,6 @@ public class FilterSecurityInterceptorTests {
|
||||
|
||||
private ApplicationEventPublisher publisher;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public final void setUp() {
|
||||
interceptor = new FilterSecurityInterceptor();
|
||||
|
||||
@@ -68,9 +68,6 @@ public class AbstractAuthenticationProcessingFilterTests {
|
||||
|
||||
SimpleUrlAuthenticationFailureHandler failureHandler;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private MockHttpServletRequest createMockAuthenticationRequest() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
@@ -476,9 +473,6 @@ public class AbstractAuthenticationProcessingFilterTests {
|
||||
filter.setRememberMeServices(null);
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
|
||||
|
||||
private static final String DEFAULT_FILTER_PROCESSING_URL = "/j_mock_post";
|
||||
|
||||
@@ -48,9 +48,6 @@ import static org.mockito.Mockito.mock;
|
||||
*/
|
||||
public class AnonymousAuthenticationFilterTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private void executeFilterInContainerSimulator(FilterConfig filterConfig, Filter filter, ServletRequest request,
|
||||
ServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
filter.doFilter(request, response, filterChain);
|
||||
@@ -109,9 +106,6 @@ public class AnonymousAuthenticationFilterTests {
|
||||
// again
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockFilterChain implements FilterChain {
|
||||
|
||||
private boolean expectToProceed;
|
||||
|
||||
@@ -34,9 +34,6 @@ import org.springframework.security.web.PortMapperImpl;
|
||||
*/
|
||||
public class LoginUrlAuthenticationEntryPointTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testDetectsMissingLoginFormUrl() {
|
||||
new LoginUrlAuthenticationEntryPoint(null);
|
||||
|
||||
@@ -35,9 +35,6 @@ import org.springframework.security.core.AuthenticationException;
|
||||
*/
|
||||
public class UsernamePasswordAuthenticationFilterTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void testNormalOperation() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("POST", "/");
|
||||
|
||||
@@ -27,9 +27,6 @@ import java.security.cert.X509Certificate;
|
||||
*/
|
||||
public class X509TestUtils {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* Builds an X.509 certificate. In human-readable form it is:
|
||||
*
|
||||
|
||||
@@ -482,9 +482,6 @@ public class AbstractRememberMeServicesTests {
|
||||
assertThat(returnedCookie.getMaxAge()).isZero();
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
static class MockRememberMeServices extends AbstractRememberMeServices {
|
||||
|
||||
boolean loginSuccessCalled;
|
||||
|
||||
@@ -28,8 +28,6 @@ import org.springframework.security.web.authentication.NullRememberMeServices;
|
||||
*/
|
||||
public class NullRememberMeServicesTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testAlwaysReturnsNull() {
|
||||
NullRememberMeServices services = new NullRememberMeServices();
|
||||
|
||||
@@ -46,9 +46,6 @@ public class RememberMeAuthenticationFilterTests {
|
||||
|
||||
Authentication remembered = new TestingAuthenticationToken("remembered", "password", "ROLE_REMEMBERED");
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
SecurityContextHolder.clearContext();
|
||||
@@ -155,9 +152,6 @@ public class RememberMeAuthenticationFilterTests {
|
||||
verifyZeroInteractions(fc);
|
||||
}
|
||||
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockRememberMeServices implements RememberMeServices {
|
||||
|
||||
private Authentication authToReturn;
|
||||
|
||||
@@ -54,9 +54,6 @@ public class TokenBasedRememberMeServicesTests {
|
||||
|
||||
private TokenBasedRememberMeServices services;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void createTokenBasedRememberMeServices() {
|
||||
uds = mock(UserDetailsService.class);
|
||||
|
||||
@@ -547,8 +547,6 @@ public class SwitchUserFilterTests {
|
||||
SwitchUserFilter filter = new SwitchUserFilter();
|
||||
filter.setSwitchFailureUrl("/foo");
|
||||
}
|
||||
// ~ Inner Classes
|
||||
// ==================================================================================================
|
||||
|
||||
private class MockUserDetailsService implements UserDetailsService {
|
||||
|
||||
|
||||
@@ -50,16 +50,10 @@ import java.nio.charset.StandardCharsets;
|
||||
*/
|
||||
public class BasicAuthenticationFilterTests {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private BasicAuthenticationFilter filter;
|
||||
|
||||
private AuthenticationManager manager;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
SecurityContextHolder.clearContext();
|
||||
|
||||
@@ -31,11 +31,6 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class DigestAuthUtilsTests {
|
||||
|
||||
// ~ Constructors
|
||||
// ===================================================================================================
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
@Test
|
||||
public void testSplitEachArrayElementAndCreateMapNormalOperation() {
|
||||
// note it ignores malformed entries (ie those without an equals sign)
|
||||
|
||||
@@ -37,9 +37,6 @@ import static org.assertj.core.api.Assertions.fail;
|
||||
*/
|
||||
public class DigestAuthenticationEntryPointTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private void checkNonceValid(String nonce) {
|
||||
// Check the nonce seems to be generated correctly
|
||||
// format of nonce is:
|
||||
|
||||
@@ -54,9 +54,6 @@ import static org.mockito.Mockito.verify;
|
||||
*/
|
||||
public class DigestAuthenticationFilterTests {
|
||||
|
||||
// ~ Static fields/initializers
|
||||
// =====================================================================================
|
||||
|
||||
private static final String NC = "00000002";
|
||||
|
||||
private static final String CNONCE = "c822c727a648aba7";
|
||||
@@ -78,17 +75,11 @@ public class DigestAuthenticationFilterTests {
|
||||
*/
|
||||
private static final String NONCE = generateNonce(60);
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
// private ApplicationContext ctx;
|
||||
private DigestAuthenticationFilter filter;
|
||||
|
||||
private MockHttpServletRequest request;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
private String createAuthorizationHeader(String username, String realm, String nonce, String uri,
|
||||
String responseDigest, String qop, String nc, String cnonce) {
|
||||
return "Digest username=\"" + username + "\", realm=\"" + realm + "\", nonce=\"" + nonce + "\", uri=\"" + uri
|
||||
|
||||
@@ -57,8 +57,6 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
*/
|
||||
public class JaasApiIntegrationFilterTests {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
private JaasApiIntegrationFilter filter;
|
||||
|
||||
private MockHttpServletRequest request;
|
||||
@@ -73,9 +71,6 @@ public class JaasApiIntegrationFilterTests {
|
||||
|
||||
private CallbackHandler callbackHandler;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Before
|
||||
public void onBeforeTests() throws Exception {
|
||||
this.filter = new JaasApiIntegrationFilter();
|
||||
@@ -193,9 +188,6 @@ public class JaasApiIntegrationFilterTests {
|
||||
assertJaasSubjectEquals(new Subject());
|
||||
}
|
||||
|
||||
// ~ Helper Methods
|
||||
// ====================================================================================================
|
||||
|
||||
private void assertJaasSubjectEquals(final Subject expectedValue) throws Exception {
|
||||
MockFilterChain chain = new MockFilterChain() {
|
||||
|
||||
|
||||
@@ -113,9 +113,6 @@ public class SecurityContextHolderAwareRequestFilterTests {
|
||||
SecurityContextHolder.clearContext();
|
||||
}
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
@Test
|
||||
public void expectedRequestWrapperClassIsUsed() throws Exception {
|
||||
this.filter.setRolePrefix("ROLE_");
|
||||
|
||||
@@ -33,9 +33,6 @@ import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
*/
|
||||
public class HttpSessionEventPublisherTests {
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
/**
|
||||
* It's not that complicated so we'll just run it straight through here.
|
||||
*/
|
||||
|
||||
@@ -28,18 +28,12 @@ import org.springframework.security.web.session.HttpSessionDestroyedEvent;
|
||||
*/
|
||||
public class MockApplicationListener implements ApplicationListener<ApplicationEvent> {
|
||||
|
||||
// ~ Instance fields
|
||||
// ================================================================================================
|
||||
|
||||
private HttpSessionCreatedEvent createdEvent;
|
||||
|
||||
private HttpSessionDestroyedEvent destroyedEvent;
|
||||
|
||||
private HttpSessionIdChangedEvent sessionIdChangedEvent;
|
||||
|
||||
// ~ Methods
|
||||
// ========================================================================================================
|
||||
|
||||
public HttpSessionCreatedEvent getCreatedEvent() {
|
||||
return createdEvent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user