diff --git a/web/src/test/java/org/springframework/security/MockPortResolver.java b/web/src/test/java/org/springframework/security/MockPortResolver.java index 10ea448b463..db35ae0b822 100644 --- a/web/src/test/java/org/springframework/security/MockPortResolver.java +++ b/web/src/test/java/org/springframework/security/MockPortResolver.java @@ -24,9 +24,12 @@ * Always returns the constructor-specified HTTP and HTTPS ports. * * @author Ben Alex + * @author nomoreFt */ public class MockPortResolver implements PortResolver { + private static final String HTTPS_SCHEME = "https"; + private int http = 80; private int https = 443; @@ -38,7 +41,7 @@ public MockPortResolver(int http, int https) { @Override public int getServerPort(ServletRequest request) { - if ((request.getScheme() != null) && request.getScheme().equals("https")) { + if (request.getScheme() != null && HTTPS_SCHEME.equals(request.getScheme())) { return this.https; } else {