Fix JUnit 4 to AssertJ migration bugs
The migration from JUnit 4 assertions to AssertJ assertions resulted in several unnecessary casts from int to long that actually cause assertions to pass when they should otherwise fail. This commit fixes all such bugs for the pattern `.isNotEqualTo((long)`.
This commit is contained in:
parent
c840ba9989
commit
449377908f
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -126,7 +126,7 @@ public class DefinitionMetadataEqualsHashCodeTests {
|
|||
assertThat(equal.hashCode()).as("Hash code for equal instances should match").isEqualTo(master.hashCode());
|
||||
|
||||
assertThat(notEqual).as("Should not be equal").isNotEqualTo(master);
|
||||
assertThat(notEqual.hashCode()).as("Hash code for non-equal instances should not match").isNotEqualTo((long) master.hashCode());
|
||||
assertThat(notEqual.hashCode()).as("Hash code for non-equal instances should not match").isNotEqualTo(master.hashCode());
|
||||
|
||||
assertThat(subclass).as("Subclass should be equal").isEqualTo(master);
|
||||
assertThat(subclass.hashCode()).as("Hash code for subclass should match").isEqualTo(master.hashCode());
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -89,7 +89,7 @@ class MethodParameterTests {
|
|||
Method method = getClass().getMethod("method", String.class, Long.TYPE);
|
||||
MethodParameter methodParameter = new MethodParameter(method, 0);
|
||||
assertThat(methodParameter.hashCode()).isEqualTo(stringParameter.hashCode());
|
||||
assertThat(methodParameter.hashCode()).isNotEqualTo((long) longParameter.hashCode());
|
||||
assertThat(methodParameter.hashCode()).isNotEqualTo(longParameter.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -86,7 +86,7 @@ class SynthesizingMethodParameterTests {
|
|||
Method method = getClass().getMethod("method", String.class, Long.TYPE);
|
||||
SynthesizingMethodParameter methodParameter = new SynthesizingMethodParameter(method, 0);
|
||||
assertThat(methodParameter.hashCode()).isEqualTo(stringParameter.hashCode());
|
||||
assertThat(methodParameter.hashCode()).isNotEqualTo((long) longParameter.hashCode());
|
||||
assertThat(methodParameter.hashCode()).isNotEqualTo(longParameter.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -89,8 +89,8 @@ public class ReflectionHelperTests extends AbstractExpressionTests {
|
|||
assertThat(tv1).isNotEqualTo(tv3);
|
||||
assertThat(tv2).isNotEqualTo(tv3);
|
||||
assertThat(tv2.hashCode()).isEqualTo(tv1.hashCode());
|
||||
assertThat(tv3.hashCode()).isNotEqualTo((long) tv1.hashCode());
|
||||
assertThat(tv3.hashCode()).isNotEqualTo((long) tv2.hashCode());
|
||||
assertThat(tv3.hashCode()).isNotEqualTo(tv1.hashCode());
|
||||
assertThat(tv3.hashCode()).isNotEqualTo(tv2.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -55,14 +55,14 @@ class MergedContextConfigurationTests {
|
|||
void hashCodeWithNulls() {
|
||||
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(null, null, null, null, null);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(null, null, null, null, null);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void hashCodeWithNullArrays() {
|
||||
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), null, null, null, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), null, null, null, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -71,7 +71,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -80,7 +80,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader());
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -90,7 +90,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations,
|
||||
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -101,7 +101,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations2,
|
||||
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -111,7 +111,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -122,7 +122,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, classes1, EMPTY_STRING_ARRAY, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, classes2, EMPTY_STRING_ARRAY, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -132,7 +132,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -143,7 +143,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -154,7 +154,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -165,7 +165,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -184,7 +184,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -201,7 +201,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader);
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -216,7 +216,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
|
||||
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent);
|
||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -233,7 +233,7 @@ class MergedContextConfigurationTests {
|
|||
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent1);
|
||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
|
||||
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent2);
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -58,7 +58,7 @@ class ServerHttpRequestIntegrationTests extends AbstractHttpHandlerIntegrationTe
|
|||
URI uri = request.getURI();
|
||||
assertThat(uri.getScheme()).isEqualTo("http");
|
||||
assertThat(uri.getHost()).isNotNull();
|
||||
assertThat(uri.getPort()).isNotEqualTo((long) -1);
|
||||
assertThat(uri.getPort()).isNotEqualTo(-1);
|
||||
assertThat(request.getRemoteAddress()).isNotNull();
|
||||
assertThat(uri.getPath()).isEqualTo("/foo");
|
||||
assertThat(uri.getQuery()).isEqualTo("param=bar");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -95,7 +95,7 @@ class ServerHttpsRequestIntegrationTests {
|
|||
URI uri = request.getURI();
|
||||
assertThat(uri.getScheme()).isEqualTo("https");
|
||||
assertThat(uri.getHost()).isNotNull();
|
||||
assertThat(uri.getPort()).isNotEqualTo((long) -1);
|
||||
assertThat(uri.getPort()).isNotEqualTo(-1);
|
||||
assertThat(request.getRemoteAddress()).isNotNull();
|
||||
assertThat(uri.getPath()).isEqualTo("/foo");
|
||||
assertThat(uri.getQuery()).isEqualTo("param=bar");
|
||||
|
|
|
|||
|
|
@ -108,12 +108,11 @@ public class PathPatternParserTests {
|
|||
assertThat(pp2).isEqualTo(pp1);
|
||||
assertThat(pp2.hashCode()).isEqualTo(pp1.hashCode());
|
||||
assertThat(pp3).isNotEqualTo(pp1);
|
||||
assertThat(pp1.equals("abc")).isFalse();
|
||||
|
||||
pp1 = caseInsensitiveParser.parse("/abc");
|
||||
pp2 = caseSensitiveParser.parse("/abc");
|
||||
assertThat(pp1.equals(pp2)).isFalse();
|
||||
assertThat(pp2.hashCode()).isNotEqualTo((long) pp1.hashCode());
|
||||
assertThat(pp2.hashCode()).isNotEqualTo(pp1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(RequestMethod.GET, RequestMethod.POST)
|
||||
.params("foo=bar").headers("foo=bar")
|
||||
|
|
@ -242,7 +242,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||
.params("/NOOOOOO").headers("foo=bar")
|
||||
|
|
@ -251,7 +251,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||
.params("foo=bar").headers("/NOOOOOO")
|
||||
|
|
@ -260,7 +260,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||
.params("foo=bar").headers("foo=bar")
|
||||
|
|
@ -269,7 +269,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||
.params("foo=bar").headers("foo=bar")
|
||||
|
|
@ -278,7 +278,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||
.params("foo=bar").headers("foo=bar")
|
||||
|
|
@ -287,7 +287,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -230,7 +230,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(GET, RequestMethod.POST)
|
||||
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
||||
|
|
@ -238,7 +238,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(GET)
|
||||
.params("/NOOOOOO", "customFoo=customBar").headers("foo=bar")
|
||||
|
|
@ -246,7 +246,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(GET)
|
||||
.params("foo=bar", "customFoo=customBar").headers("/NOOOOOO")
|
||||
|
|
@ -254,7 +254,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(GET)
|
||||
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
||||
|
|
@ -262,7 +262,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(GET)
|
||||
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
||||
|
|
@ -270,7 +270,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
|
||||
info2 = paths("/foo").methods(GET)
|
||||
.params("foo=bar", "customFoo=NOOOOOO").headers("foo=bar")
|
||||
|
|
@ -278,7 +278,7 @@ public class RequestMappingInfoTests {
|
|||
.build();
|
||||
|
||||
assertThat(info1.equals(info2)).isFalse();
|
||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
||||
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -57,7 +57,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
|||
List<String> allowed = Collections.singletonList("https://mydomain1.example");
|
||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(allowed);
|
||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -75,7 +75,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
|||
List<String> allowed = Arrays.asList("https://mydomain1.example", "https://mydomain2.example", "http://mydomain3.example");
|
||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(allowed);
|
||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -104,7 +104,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
|||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
|
||||
interceptor.setAllowedOrigins(Collections.singletonList("*"));
|
||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -113,7 +113,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
|||
this.servletRequest.setServerName("mydomain2.example");
|
||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Collections.emptyList());
|
||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -122,7 +122,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
|||
this.servletRequest.setServerName("mydomain2.example");
|
||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Arrays.asList("http://mydomain1.example"));
|
||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -286,7 +286,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests {
|
|||
String sockJsPath = "/websocket";
|
||||
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||
wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo((long) 403);
|
||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo(403);
|
||||
|
||||
resetRequestAndResponse();
|
||||
List<String> allowed = Collections.singletonList("https://mydomain1.example");
|
||||
|
|
@ -295,7 +295,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests {
|
|||
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain1.example");
|
||||
wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo((long) 403);
|
||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo(403);
|
||||
|
||||
resetRequestAndResponse();
|
||||
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||
|
|
@ -309,7 +309,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests {
|
|||
String sockJsPath = "/iframe.html";
|
||||
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||
this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo((long) 404);
|
||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo(404);
|
||||
assertThat(this.servletResponse.getHeader("X-Frame-Options")).isEqualTo("SAMEORIGIN");
|
||||
|
||||
resetRequestAndResponse();
|
||||
|
|
@ -323,7 +323,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests {
|
|||
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||
this.service.setAllowedOrigins(Collections.singletonList("*"));
|
||||
this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo((long) 404);
|
||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo(404);
|
||||
assertThat(this.servletResponse.getHeader("X-Frame-Options")).isNull();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue