Objects with multi-threaded access should not lazily populate a hash field
Issue. SPR-11428
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2014 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.
|
||||
@@ -16,18 +16,12 @@
|
||||
|
||||
package org.springframework.web.servlet.mvc.method;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.servlet.mvc.condition.ConsumesRequestCondition;
|
||||
@@ -37,6 +31,9 @@ import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition;
|
||||
import org.springframework.web.servlet.mvc.condition.ProducesRequestCondition;
|
||||
import org.springframework.web.servlet.mvc.condition.RequestMethodsRequestCondition;
|
||||
|
||||
import static java.util.Arrays.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Test fixture for {@link RequestMappingInfo} tests.
|
||||
*
|
||||
@@ -212,7 +209,6 @@ public class RequestMappingInfoTests {
|
||||
|
||||
@Test
|
||||
public void equals() {
|
||||
|
||||
RequestMappingInfo info1 = new RequestMappingInfo(
|
||||
new PatternsRequestCondition("/foo"),
|
||||
new RequestMethodsRequestCondition(RequestMethod.GET),
|
||||
@@ -244,7 +240,7 @@ public class RequestMappingInfoTests {
|
||||
new ParamsRequestCondition("customFoo=customBar"));
|
||||
|
||||
assertFalse(info1.equals(info2));
|
||||
assertTrue(info1.hashCode() != info2.hashCode());
|
||||
assertNotEquals(info1.hashCode(), info2.hashCode());
|
||||
|
||||
info2 = new RequestMappingInfo(
|
||||
new PatternsRequestCondition("/foo"),
|
||||
@@ -256,7 +252,7 @@ public class RequestMappingInfoTests {
|
||||
new ParamsRequestCondition("customFoo=customBar"));
|
||||
|
||||
assertFalse(info1.equals(info2));
|
||||
assertTrue(info1.hashCode() != info2.hashCode());
|
||||
assertNotEquals(info1.hashCode(), info2.hashCode());
|
||||
|
||||
info2 = new RequestMappingInfo(
|
||||
new PatternsRequestCondition("/foo"),
|
||||
@@ -268,7 +264,7 @@ public class RequestMappingInfoTests {
|
||||
new ParamsRequestCondition("customFoo=customBar"));
|
||||
|
||||
assertFalse(info1.equals(info2));
|
||||
assertTrue(info1.hashCode() != info2.hashCode());
|
||||
assertNotEquals(info1.hashCode(), info2.hashCode());
|
||||
|
||||
info2 = new RequestMappingInfo(
|
||||
new PatternsRequestCondition("/foo"),
|
||||
@@ -280,7 +276,7 @@ public class RequestMappingInfoTests {
|
||||
new ParamsRequestCondition("customFoo=customBar"));
|
||||
|
||||
assertFalse(info1.equals(info2));
|
||||
assertTrue(info1.hashCode() != info2.hashCode());
|
||||
assertNotEquals(info1.hashCode(), info2.hashCode());
|
||||
|
||||
info2 = new RequestMappingInfo(
|
||||
new PatternsRequestCondition("/foo"),
|
||||
@@ -292,7 +288,7 @@ public class RequestMappingInfoTests {
|
||||
new ParamsRequestCondition("customFoo=customBar"));
|
||||
|
||||
assertFalse(info1.equals(info2));
|
||||
assertTrue(info1.hashCode() != info2.hashCode());
|
||||
assertNotEquals(info1.hashCode(), info2.hashCode());
|
||||
|
||||
info2 = new RequestMappingInfo(
|
||||
new PatternsRequestCondition("/foo"),
|
||||
@@ -304,7 +300,7 @@ public class RequestMappingInfoTests {
|
||||
new ParamsRequestCondition("customFoo=customBar"));
|
||||
|
||||
assertFalse(info1.equals(info2));
|
||||
assertTrue(info1.hashCode() != info2.hashCode());
|
||||
assertNotEquals(info1.hashCode(), info2.hashCode());
|
||||
|
||||
info2 = new RequestMappingInfo(
|
||||
new PatternsRequestCondition("/foo"),
|
||||
@@ -316,7 +312,7 @@ public class RequestMappingInfoTests {
|
||||
new ParamsRequestCondition("customFoo=NOOOOOO"));
|
||||
|
||||
assertFalse(info1.equals(info2));
|
||||
assertTrue(info1.hashCode() != info2.hashCode());
|
||||
assertNotEquals(info1.hashCode(), info2.hashCode());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user