Merge branch '5.2.x'
This commit is contained in:
commit
705cf09ad7
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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(equal.hashCode()).as("Hash code for equal instances should match").isEqualTo(master.hashCode());
|
||||||
|
|
||||||
assertThat(notEqual).as("Should not be equal").isNotEqualTo(master);
|
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).as("Subclass should be equal").isEqualTo(master);
|
||||||
assertThat(subclass.hashCode()).as("Hash code for subclass should match").isEqualTo(master.hashCode());
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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);
|
Method method = getClass().getMethod("method", String.class, Long.TYPE);
|
||||||
MethodParameter methodParameter = new MethodParameter(method, 0);
|
MethodParameter methodParameter = new MethodParameter(method, 0);
|
||||||
assertThat(methodParameter.hashCode()).isEqualTo(stringParameter.hashCode());
|
assertThat(methodParameter.hashCode()).isEqualTo(stringParameter.hashCode());
|
||||||
assertThat(methodParameter.hashCode()).isNotEqualTo((long) longParameter.hashCode());
|
assertThat(methodParameter.hashCode()).isNotEqualTo(longParameter.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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);
|
Method method = getClass().getMethod("method", String.class, Long.TYPE);
|
||||||
SynthesizingMethodParameter methodParameter = new SynthesizingMethodParameter(method, 0);
|
SynthesizingMethodParameter methodParameter = new SynthesizingMethodParameter(method, 0);
|
||||||
assertThat(methodParameter.hashCode()).isEqualTo(stringParameter.hashCode());
|
assertThat(methodParameter.hashCode()).isEqualTo(stringParameter.hashCode());
|
||||||
assertThat(methodParameter.hashCode()).isNotEqualTo((long) longParameter.hashCode());
|
assertThat(methodParameter.hashCode()).isNotEqualTo(longParameter.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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(tv1).isNotEqualTo(tv3);
|
||||||
assertThat(tv2).isNotEqualTo(tv3);
|
assertThat(tv2).isNotEqualTo(tv3);
|
||||||
assertThat(tv2.hashCode()).isEqualTo(tv1.hashCode());
|
assertThat(tv2.hashCode()).isEqualTo(tv1.hashCode());
|
||||||
assertThat(tv3.hashCode()).isNotEqualTo((long) tv1.hashCode());
|
assertThat(tv3.hashCode()).isNotEqualTo(tv1.hashCode());
|
||||||
assertThat(tv3.hashCode()).isNotEqualTo((long) tv2.hashCode());
|
assertThat(tv3.hashCode()).isNotEqualTo(tv2.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -55,14 +55,14 @@ class MergedContextConfigurationTests {
|
||||||
void hashCodeWithNulls() {
|
void hashCodeWithNulls() {
|
||||||
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(null, null, null, null, null);
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(null, null, null, null, null);
|
||||||
MergedContextConfiguration mergedConfig2 = 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
|
@Test
|
||||||
void hashCodeWithNullArrays() {
|
void hashCodeWithNullArrays() {
|
||||||
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), null, null, null, loader);
|
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(), null, null, null, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = 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
|
@Test
|
||||||
|
@ -71,7 +71,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -80,7 +80,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, new AnnotationConfigContextLoader());
|
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
|
@Test
|
||||||
|
@ -90,7 +90,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations,
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations,
|
||||||
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -101,7 +101,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations2,
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), locations2,
|
||||||
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -111,7 +111,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, classes, EMPTY_STRING_ARRAY, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -122,7 +122,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, classes1, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, classes1, EMPTY_STRING_ARRAY, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, classes2, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, classes2, EMPTY_STRING_ARRAY, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -132,7 +132,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -143,7 +143,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -154,7 +154,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -165,7 +165,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles1, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, activeProfiles2, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -184,7 +184,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader);
|
||||||
assertThat(mergedConfig2.hashCode()).isEqualTo(mergedConfig1.hashCode());
|
assertThat(mergedConfig2).hasSameHashCodeAs(mergedConfig1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -201,7 +201,7 @@ class MergedContextConfigurationTests {
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses1, EMPTY_STRING_ARRAY, loader);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(),
|
||||||
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializerClasses2, EMPTY_STRING_ARRAY, loader);
|
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);
|
EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
|
||||||
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent);
|
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);
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent1);
|
||||||
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
|
MergedContextConfiguration mergedConfig2 = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY,
|
||||||
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent2);
|
EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, loader, null, parent2);
|
||||||
assertThat(mergedConfig2.hashCode()).isNotEqualTo((long) mergedConfig1.hashCode());
|
assertThat(mergedConfig2.hashCode()).isNotEqualTo(mergedConfig1.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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();
|
URI uri = request.getURI();
|
||||||
assertThat(uri.getScheme()).isEqualTo("http");
|
assertThat(uri.getScheme()).isEqualTo("http");
|
||||||
assertThat(uri.getHost()).isNotNull();
|
assertThat(uri.getHost()).isNotNull();
|
||||||
assertThat(uri.getPort()).isNotEqualTo((long) -1);
|
assertThat(uri.getPort()).isNotEqualTo(-1);
|
||||||
assertThat(request.getRemoteAddress()).isNotNull();
|
assertThat(request.getRemoteAddress()).isNotNull();
|
||||||
assertThat(uri.getPath()).isEqualTo("/foo");
|
assertThat(uri.getPath()).isEqualTo("/foo");
|
||||||
assertThat(uri.getQuery()).isEqualTo("param=bar");
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -95,7 +95,7 @@ class ServerHttpsRequestIntegrationTests {
|
||||||
URI uri = request.getURI();
|
URI uri = request.getURI();
|
||||||
assertThat(uri.getScheme()).isEqualTo("https");
|
assertThat(uri.getScheme()).isEqualTo("https");
|
||||||
assertThat(uri.getHost()).isNotNull();
|
assertThat(uri.getHost()).isNotNull();
|
||||||
assertThat(uri.getPort()).isNotEqualTo((long) -1);
|
assertThat(uri.getPort()).isNotEqualTo(-1);
|
||||||
assertThat(request.getRemoteAddress()).isNotNull();
|
assertThat(request.getRemoteAddress()).isNotNull();
|
||||||
assertThat(uri.getPath()).isEqualTo("/foo");
|
assertThat(uri.getPath()).isEqualTo("/foo");
|
||||||
assertThat(uri.getQuery()).isEqualTo("param=bar");
|
assertThat(uri.getQuery()).isEqualTo("param=bar");
|
||||||
|
|
|
@ -109,12 +109,11 @@ public class PathPatternParserTests {
|
||||||
assertThat(pp2).isEqualTo(pp1);
|
assertThat(pp2).isEqualTo(pp1);
|
||||||
assertThat(pp2.hashCode()).isEqualTo(pp1.hashCode());
|
assertThat(pp2.hashCode()).isEqualTo(pp1.hashCode());
|
||||||
assertThat(pp3).isNotEqualTo(pp1);
|
assertThat(pp3).isNotEqualTo(pp1);
|
||||||
assertThat(pp1.equals("abc")).isFalse();
|
|
||||||
|
|
||||||
pp1 = caseInsensitiveParser.parse("/abc");
|
pp1 = caseInsensitiveParser.parse("/abc");
|
||||||
pp2 = caseSensitiveParser.parse("/abc");
|
pp2 = caseSensitiveParser.parse("/abc");
|
||||||
assertThat(pp1.equals(pp2)).isFalse();
|
assertThat(pp1.equals(pp2)).isFalse();
|
||||||
assertThat(pp2.hashCode()).isNotEqualTo((long) pp1.hashCode());
|
assertThat(pp2.hashCode()).isNotEqualTo(pp1.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -233,7 +233,7 @@ public class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
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)
|
info2 = paths("/foo").methods(RequestMethod.GET, RequestMethod.POST)
|
||||||
.params("foo=bar").headers("foo=bar")
|
.params("foo=bar").headers("foo=bar")
|
||||||
|
@ -242,7 +242,7 @@ public class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||||
.params("/NOOOOOO").headers("foo=bar")
|
.params("/NOOOOOO").headers("foo=bar")
|
||||||
|
@ -251,7 +251,7 @@ public class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||||
.params("foo=bar").headers("/NOOOOOO")
|
.params("foo=bar").headers("/NOOOOOO")
|
||||||
|
@ -260,7 +260,7 @@ public class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||||
.params("foo=bar").headers("foo=bar")
|
.params("foo=bar").headers("foo=bar")
|
||||||
|
@ -269,7 +269,7 @@ public class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||||
.params("foo=bar").headers("foo=bar")
|
.params("foo=bar").headers("foo=bar")
|
||||||
|
@ -278,7 +278,7 @@ public class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = paths("/foo").methods(RequestMethod.GET)
|
info2 = paths("/foo").methods(RequestMethod.GET)
|
||||||
.params("foo=bar").headers("foo=bar")
|
.params("foo=bar").headers("foo=bar")
|
||||||
|
@ -287,7 +287,7 @@ public class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -251,7 +251,7 @@ class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = infoBuilder.paths("/foo").methods(GET, RequestMethod.POST)
|
info2 = infoBuilder.paths("/foo").methods(GET, RequestMethod.POST)
|
||||||
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
||||||
|
@ -259,7 +259,7 @@ class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = infoBuilder.paths("/foo").methods(GET)
|
info2 = infoBuilder.paths("/foo").methods(GET)
|
||||||
.params("/NOOOOOO", "customFoo=customBar").headers("foo=bar")
|
.params("/NOOOOOO", "customFoo=customBar").headers("foo=bar")
|
||||||
|
@ -267,7 +267,7 @@ class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = infoBuilder.paths("/foo").methods(GET)
|
info2 = infoBuilder.paths("/foo").methods(GET)
|
||||||
.params("foo=bar", "customFoo=customBar").headers("/NOOOOOO")
|
.params("foo=bar", "customFoo=customBar").headers("/NOOOOOO")
|
||||||
|
@ -275,7 +275,7 @@ class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = infoBuilder.paths("/foo").methods(GET)
|
info2 = infoBuilder.paths("/foo").methods(GET)
|
||||||
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
||||||
|
@ -283,7 +283,7 @@ class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = infoBuilder.paths("/foo").methods(GET)
|
info2 = infoBuilder.paths("/foo").methods(GET)
|
||||||
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
.params("foo=bar", "customFoo=customBar").headers("foo=bar")
|
||||||
|
@ -291,7 +291,7 @@ class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
|
|
||||||
info2 = infoBuilder.paths("/foo").methods(GET)
|
info2 = infoBuilder.paths("/foo").methods(GET)
|
||||||
.params("foo=bar", "customFoo=NOOOOOO").headers("foo=bar")
|
.params("foo=bar", "customFoo=NOOOOOO").headers("foo=bar")
|
||||||
|
@ -299,7 +299,7 @@ class RequestMappingInfoTests {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertThat(info1.equals(info2)).isFalse();
|
assertThat(info1.equals(info2)).isFalse();
|
||||||
assertThat(info2.hashCode()).isNotEqualTo((long) info1.hashCode());
|
assertThat(info2.hashCode()).isNotEqualTo(info1.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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");
|
List<String> allowed = Collections.singletonList("https://mydomain1.example");
|
||||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(allowed);
|
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(allowed);
|
||||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -75,7 +75,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||||
List<String> allowed = Arrays.asList("https://mydomain1.example", "https://mydomain2.example", "http://mydomain3.example");
|
List<String> allowed = Arrays.asList("https://mydomain1.example", "https://mydomain2.example", "http://mydomain3.example");
|
||||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(allowed);
|
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(allowed);
|
||||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -104,7 +104,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
|
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor();
|
||||||
interceptor.setAllowedOrigins(Collections.singletonList("*"));
|
interceptor.setAllowedOrigins(Collections.singletonList("*"));
|
||||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -113,7 +113,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||||
this.servletRequest.setServerName("mydomain2.example");
|
this.servletRequest.setServerName("mydomain2.example");
|
||||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Collections.emptyList());
|
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Collections.emptyList());
|
||||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -122,7 +122,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests {
|
||||||
this.servletRequest.setServerName("mydomain2.example");
|
this.servletRequest.setServerName("mydomain2.example");
|
||||||
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Arrays.asList("http://mydomain1.example"));
|
OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Arrays.asList("http://mydomain1.example"));
|
||||||
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
assertThat(interceptor.beforeHandshake(request, response, wsHandler, attributes)).isTrue();
|
||||||
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo((long) servletResponse.getStatus());
|
assertThat(HttpStatus.FORBIDDEN.value()).isNotEqualTo(servletResponse.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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";
|
String sockJsPath = "/websocket";
|
||||||
setRequest("GET", sockJsPrefix + sockJsPath);
|
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||||
wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
||||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo((long) 403);
|
assertThat(this.servletResponse.getStatus()).isNotEqualTo(403);
|
||||||
|
|
||||||
resetRequestAndResponse();
|
resetRequestAndResponse();
|
||||||
List<String> allowed = Collections.singletonList("https://mydomain1.example");
|
List<String> allowed = Collections.singletonList("https://mydomain1.example");
|
||||||
|
@ -295,7 +295,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests {
|
||||||
setRequest("GET", sockJsPrefix + sockJsPath);
|
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||||
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain1.example");
|
this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain1.example");
|
||||||
wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
||||||
assertThat(this.servletResponse.getStatus()).isNotEqualTo((long) 403);
|
assertThat(this.servletResponse.getStatus()).isNotEqualTo(403);
|
||||||
|
|
||||||
resetRequestAndResponse();
|
resetRequestAndResponse();
|
||||||
setRequest("GET", sockJsPrefix + sockJsPath);
|
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||||
|
@ -309,7 +309,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests {
|
||||||
String sockJsPath = "/iframe.html";
|
String sockJsPath = "/iframe.html";
|
||||||
setRequest("GET", sockJsPrefix + sockJsPath);
|
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||||
this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
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");
|
assertThat(this.servletResponse.getHeader("X-Frame-Options")).isEqualTo("SAMEORIGIN");
|
||||||
|
|
||||||
resetRequestAndResponse();
|
resetRequestAndResponse();
|
||||||
|
@ -323,7 +323,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests {
|
||||||
setRequest("GET", sockJsPrefix + sockJsPath);
|
setRequest("GET", sockJsPrefix + sockJsPath);
|
||||||
this.service.setAllowedOrigins(Collections.singletonList("*"));
|
this.service.setAllowedOrigins(Collections.singletonList("*"));
|
||||||
this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler);
|
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();
|
assertThat(this.servletResponse.getHeader("X-Frame-Options")).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue