Use modern language features in tests
This commit is contained in:
@@ -195,14 +195,22 @@ public class PagedListHolderTests {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) {
|
||||||
if (!(o instanceof MockFilter)) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof MockFilter mockFilter)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final MockFilter mockFilter = (MockFilter) o;
|
if (!age.equals(mockFilter.age)) {
|
||||||
|
return false;
|
||||||
if (!age.equals(mockFilter.age)) return false;
|
}
|
||||||
if (!extendedInfo.equals(mockFilter.extendedInfo)) return false;
|
if (!extendedInfo.equals(mockFilter.extendedInfo)) {
|
||||||
if (!name.equals(mockFilter.name)) return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (!name.equals(mockFilter.name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,9 @@ public class NestedTestBean implements INestedTestBean {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof NestedTestBean)) {
|
if (!(obj instanceof NestedTestBean ntb)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NestedTestBean ntb = (NestedTestBean) obj;
|
|
||||||
return this.company.equals(ntb.company);
|
return this.company.equals(ntb.company);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,10 +64,9 @@ public class SerializablePerson implements Person, Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (!(other instanceof SerializablePerson)) {
|
if (!(other instanceof SerializablePerson p)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SerializablePerson p = (SerializablePerson) other;
|
|
||||||
return p.age == age && ObjectUtils.nullSafeEquals(name, p.name);
|
return p.age == age && ObjectUtils.nullSafeEquals(name, p.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -468,10 +468,9 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
|||||||
if (this == other) {
|
if (this == other) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(other instanceof TestBean)) {
|
if (!(other instanceof TestBean tb2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TestBean tb2 = (TestBean) other;
|
|
||||||
return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age);
|
return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -261,11 +261,9 @@ public abstract class AbstractBeanFactoryTests {
|
|||||||
@Test
|
@Test
|
||||||
public void aliasing() {
|
public void aliasing() {
|
||||||
BeanFactory bf = getBeanFactory();
|
BeanFactory bf = getBeanFactory();
|
||||||
if (!(bf instanceof ConfigurableBeanFactory)) {
|
if (!(bf instanceof ConfigurableBeanFactory cbf)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) bf;
|
|
||||||
|
|
||||||
String alias = "rods alias";
|
String alias = "rods alias";
|
||||||
|
|
||||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
|
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
|
||||||
|
|||||||
@@ -1358,7 +1358,7 @@ class ConfigurationClassPostProcessorTests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Repository<String> stringRepo() {
|
public Repository<String> stringRepo() {
|
||||||
return new Repository<String>() {
|
return new Repository<>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Repository<String>";
|
return "Repository<String>";
|
||||||
@@ -1368,7 +1368,7 @@ class ConfigurationClassPostProcessorTests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Repository<Integer> integerRepo() {
|
public Repository<Integer> integerRepo() {
|
||||||
return new Repository<Integer>() {
|
return new Repository<>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Repository<Integer>";
|
return "Repository<Integer>";
|
||||||
@@ -1378,7 +1378,7 @@ class ConfigurationClassPostProcessorTests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Repository<?> genericRepo() {
|
public Repository<?> genericRepo() {
|
||||||
return new Repository<Object>() {
|
return new Repository<>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Repository<Object>";
|
return "Repository<Object>";
|
||||||
@@ -1423,7 +1423,7 @@ class ConfigurationClassPostProcessorTests {
|
|||||||
@Bean
|
@Bean
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public Repository<String> stringRepo() {
|
public Repository<String> stringRepo() {
|
||||||
return new Repository<String>() {
|
return new Repository<>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Repository<String>";
|
return "Repository<String>";
|
||||||
@@ -1434,7 +1434,7 @@ class ConfigurationClassPostProcessorTests {
|
|||||||
@Bean
|
@Bean
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public Repository<Integer> integerRepo() {
|
public Repository<Integer> integerRepo() {
|
||||||
return new Repository<Integer>() {
|
return new Repository<>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Repository<Integer>";
|
return "Repository<Integer>";
|
||||||
@@ -1446,7 +1446,7 @@ class ConfigurationClassPostProcessorTests {
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public Repository genericRepo() {
|
public Repository genericRepo() {
|
||||||
return new Repository<Object>() {
|
return new Repository<>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Repository<Object>";
|
return "Repository<Object>";
|
||||||
@@ -1468,7 +1468,7 @@ class ConfigurationClassPostProcessorTests {
|
|||||||
@Bean
|
@Bean
|
||||||
@Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
@Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||||
public Repository<String> stringRepo() {
|
public Repository<String> stringRepo() {
|
||||||
return new Repository<String>() {
|
return new Repository<>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Repository<String>";
|
return "Repository<String>";
|
||||||
@@ -1479,7 +1479,7 @@ class ConfigurationClassPostProcessorTests {
|
|||||||
@Bean
|
@Bean
|
||||||
@PrototypeScoped
|
@PrototypeScoped
|
||||||
public Repository<Integer> integerRepo() {
|
public Repository<Integer> integerRepo() {
|
||||||
return new Repository<Integer>() {
|
return new Repository<>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Repository<Integer>";
|
return "Repository<Integer>";
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class ConfigurationWithFactoryBeanBeanEarlyDeductionTests {
|
|||||||
beanDefinition.setFactoryBeanName("factoryBean");
|
beanDefinition.setFactoryBeanName("factoryBean");
|
||||||
beanDefinition.setFactoryMethodName("myBean");
|
beanDefinition.setFactoryMethodName("myBean");
|
||||||
GenericApplicationContext context = new GenericApplicationContext();
|
GenericApplicationContext context = new GenericApplicationContext();
|
||||||
try {
|
try (context) {
|
||||||
context.registerBeanDefinition("factoryBean", factoryBeanDefinition);
|
context.registerBeanDefinition("factoryBean", factoryBeanDefinition);
|
||||||
context.registerBeanDefinition("myBean", beanDefinition);
|
context.registerBeanDefinition("myBean", beanDefinition);
|
||||||
NameCollectingBeanFactoryPostProcessor postProcessor = new NameCollectingBeanFactoryPostProcessor();
|
NameCollectingBeanFactoryPostProcessor postProcessor = new NameCollectingBeanFactoryPostProcessor();
|
||||||
@@ -103,9 +103,6 @@ public class ConfigurationWithFactoryBeanBeanEarlyDeductionTests {
|
|||||||
context.refresh();
|
context.refresh();
|
||||||
assertContainsMyBeanName(postProcessor.getNames());
|
assertContainsMyBeanName(postProcessor.getNames());
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertPostFreeze(Class<?> configurationClass) {
|
private void assertPostFreeze(Class<?> configurationClass) {
|
||||||
@@ -118,16 +115,13 @@ public class ConfigurationWithFactoryBeanBeanEarlyDeductionTests {
|
|||||||
BeanFactoryPostProcessor... postProcessors) {
|
BeanFactoryPostProcessor... postProcessors) {
|
||||||
NameCollectingBeanFactoryPostProcessor postProcessor = new NameCollectingBeanFactoryPostProcessor();
|
NameCollectingBeanFactoryPostProcessor postProcessor = new NameCollectingBeanFactoryPostProcessor();
|
||||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||||
try {
|
try (context) {
|
||||||
Arrays.stream(postProcessors).forEach(context::addBeanFactoryPostProcessor);
|
Arrays.stream(postProcessors).forEach(context::addBeanFactoryPostProcessor);
|
||||||
context.addBeanFactoryPostProcessor(postProcessor);
|
context.addBeanFactoryPostProcessor(postProcessor);
|
||||||
context.register(configurationClass);
|
context.register(configurationClass);
|
||||||
context.refresh();
|
context.refresh();
|
||||||
assertContainsMyBeanName(postProcessor.getNames());
|
assertContainsMyBeanName(postProcessor.getNames());
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
context.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertContainsMyBeanName(AnnotationConfigApplicationContext context) {
|
private void assertContainsMyBeanName(AnnotationConfigApplicationContext context) {
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ class PropertySourceAnnotationTests {
|
|||||||
@Bean
|
@Bean
|
||||||
FactoryBean<TestBean> testBean() {
|
FactoryBean<TestBean> testBean() {
|
||||||
final String name = env.getProperty("testbean.name");
|
final String name = env.getProperty("testbean.name");
|
||||||
return new FactoryBean<TestBean>() {
|
return new FactoryBean<>() {
|
||||||
@Override
|
@Override
|
||||||
public TestBean getObject() {
|
public TestBean getObject() {
|
||||||
return new TestBean(name);
|
return new TestBean(name);
|
||||||
@@ -417,7 +417,7 @@ class PropertySourceAnnotationTests {
|
|||||||
@Override
|
@Override
|
||||||
public org.springframework.core.env.PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
|
public org.springframework.core.env.PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException {
|
||||||
Properties props = PropertiesLoaderUtils.loadProperties(resource);
|
Properties props = PropertiesLoaderUtils.loadProperties(resource);
|
||||||
return new org.springframework.core.env.PropertySource<Properties>("my" + name, props) {
|
return new org.springframework.core.env.PropertySource<>("my" + name, props) {
|
||||||
@Override
|
@Override
|
||||||
public Object getProperty(String name) {
|
public Object getProperty(String name) {
|
||||||
String value = props.getProperty(name);
|
String value = props.getProperty(name);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class Spr15275Tests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public FactoryBean<Foo> foo() {
|
public FactoryBean<Foo> foo() {
|
||||||
return new FactoryBean<Foo>() {
|
return new FactoryBean<>() {
|
||||||
@Override
|
@Override
|
||||||
public Foo getObject() {
|
public Foo getObject() {
|
||||||
return new Foo("x");
|
return new Foo("x");
|
||||||
@@ -103,7 +103,7 @@ public class Spr15275Tests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public FactoryBean<Foo> foo() {
|
public FactoryBean<Foo> foo() {
|
||||||
return new AbstractFactoryBean<Foo>() {
|
return new AbstractFactoryBean<>() {
|
||||||
@Override
|
@Override
|
||||||
public Foo createInstance() {
|
public Foo createInstance() {
|
||||||
return new Foo("x");
|
return new Foo("x");
|
||||||
@@ -128,7 +128,7 @@ public class Spr15275Tests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public FactoryBean<FooInterface> foo() {
|
public FactoryBean<FooInterface> foo() {
|
||||||
return new AbstractFactoryBean<FooInterface>() {
|
return new AbstractFactoryBean<>() {
|
||||||
@Override
|
@Override
|
||||||
public FooInterface createInstance() {
|
public FooInterface createInstance() {
|
||||||
return new Foo("x");
|
return new Foo("x");
|
||||||
@@ -153,7 +153,7 @@ public class Spr15275Tests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public AbstractFactoryBean<FooInterface> foo() {
|
public AbstractFactoryBean<FooInterface> foo() {
|
||||||
return new AbstractFactoryBean<FooInterface>() {
|
return new AbstractFactoryBean<>() {
|
||||||
@Override
|
@Override
|
||||||
public FooInterface createInstance() {
|
public FooInterface createInstance() {
|
||||||
return new Foo("x");
|
return new Foo("x");
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class Spr16179Tests {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
Assembler<SomeType> someAssembler() {
|
Assembler<SomeType> someAssembler() {
|
||||||
return new Assembler<SomeType>() {};
|
return new Assembler<>() {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -774,8 +774,7 @@ class AnnotationDrivenEventListenerTests {
|
|||||||
if (event.content == null) {
|
if (event.content == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (event.content instanceof String) {
|
else if (event.content instanceof String s) {
|
||||||
String s = (String) event.content;
|
|
||||||
if (s.equals("String")) {
|
if (s.equals("String")) {
|
||||||
return event.content;
|
return event.content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class ConversionServiceFactoryBeanTests {
|
|||||||
converters.add(new ConverterFactory<String, Bar>() {
|
converters.add(new ConverterFactory<String, Bar>() {
|
||||||
@Override
|
@Override
|
||||||
public <T extends Bar> Converter<String, T> getConverter(Class<T> targetType) {
|
public <T extends Bar> Converter<String, T> getConverter(Class<T> targetType) {
|
||||||
return new Converter<String, T> () {
|
return new Converter<> () {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public T convert(String source) {
|
public T convert(String source) {
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ public class PropertySourcesPlaceholderConfigurerTests {
|
|||||||
|
|
||||||
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
|
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
|
||||||
|
|
||||||
PropertySource<?> ps = new PropertySource<Object>("simplePropertySource", new Object()) {
|
PropertySource<?> ps = new PropertySource<>("simplePropertySource", new Object()) {
|
||||||
@Override
|
@Override
|
||||||
public Object getProperty(String key) {
|
public Object getProperty(String key) {
|
||||||
return "bar";
|
return "bar";
|
||||||
|
|||||||
@@ -168,8 +168,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
|||||||
NotificationListenerBean listenerBean = new NotificationListenerBean();
|
NotificationListenerBean listenerBean = new NotificationListenerBean();
|
||||||
listenerBean.setNotificationListener(listener);
|
listenerBean.setNotificationListener(listener);
|
||||||
listenerBean.setNotificationFilter(notification -> {
|
listenerBean.setNotificationFilter(notification -> {
|
||||||
if (notification instanceof AttributeChangeNotification) {
|
if (notification instanceof AttributeChangeNotification changeNotification) {
|
||||||
AttributeChangeNotification changeNotification = (AttributeChangeNotification) notification;
|
|
||||||
return "Name".equals(changeNotification.getAttributeName());
|
return "Name".equals(changeNotification.getAttributeName());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -450,8 +449,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleNotification(Notification notification, Object handback) {
|
public void handleNotification(Notification notification, Object handback) {
|
||||||
if (notification instanceof AttributeChangeNotification) {
|
if (notification instanceof AttributeChangeNotification attNotification) {
|
||||||
AttributeChangeNotification attNotification = (AttributeChangeNotification) notification;
|
|
||||||
String attributeName = attNotification.getAttributeName();
|
String attributeName = attNotification.getAttributeName();
|
||||||
|
|
||||||
Integer currentCount = (Integer) this.attributeCounts.get(attributeName);
|
Integer currentCount = (Integer) this.attributeCounts.get(attributeName);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class BitsCronFieldTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Condition<BitsCronField> set(int... indices) {
|
private static Condition<BitsCronField> set(int... indices) {
|
||||||
return new Condition<BitsCronField>(String.format("set bits %s", Arrays.toString(indices))) {
|
return new Condition<>(String.format("set bits %s", Arrays.toString(indices))) {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(BitsCronField value) {
|
public boolean matches(BitsCronField value) {
|
||||||
for (int index : indices) {
|
for (int index : indices) {
|
||||||
@@ -122,7 +122,7 @@ class BitsCronFieldTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Condition<BitsCronField> setRange(int min, int max) {
|
private static Condition<BitsCronField> setRange(int min, int max) {
|
||||||
return new Condition<BitsCronField>(String.format("set range %d-%d", min, max)) {
|
return new Condition<>(String.format("set range %d-%d", min, max)) {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(BitsCronField value) {
|
public boolean matches(BitsCronField value) {
|
||||||
for (int i = min; i < max; i++) {
|
for (int i = min; i < max; i++) {
|
||||||
@@ -136,7 +136,7 @@ class BitsCronFieldTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Condition<BitsCronField> clear(int... indices) {
|
private static Condition<BitsCronField> clear(int... indices) {
|
||||||
return new Condition<BitsCronField>(String.format("clear bits %s", Arrays.toString(indices))) {
|
return new Condition<>(String.format("clear bits %s", Arrays.toString(indices))) {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(BitsCronField value) {
|
public boolean matches(BitsCronField value) {
|
||||||
for (int index : indices) {
|
for (int index : indices) {
|
||||||
@@ -150,7 +150,7 @@ class BitsCronFieldTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Condition<BitsCronField> clearRange(int min, int max) {
|
private static Condition<BitsCronField> clearRange(int min, int max) {
|
||||||
return new Condition<BitsCronField>(String.format("clear range %d-%d", min, max)) {
|
return new Condition<>(String.format("clear range %d-%d", min, max)) {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(BitsCronField value) {
|
public boolean matches(BitsCronField value) {
|
||||||
for (int i = min; i < max; i++) {
|
for (int i = min; i < max; i++) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
*/
|
*/
|
||||||
class CronExpressionTests {
|
class CronExpressionTests {
|
||||||
|
|
||||||
private static final Condition<Temporal> weekday = new Condition<Temporal>("weekday") {
|
private static final Condition<Temporal> weekday = new Condition<>("weekday") {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(Temporal value) {
|
public boolean matches(Temporal value) {
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ public class GenericConversionService implements ConfigurableConversionService {
|
|||||||
@Override
|
@Override
|
||||||
public void addConverter(Converter<?, ?> converter) {
|
public void addConverter(Converter<?, ?> converter) {
|
||||||
ResolvableType[] typeInfo = getRequiredTypeInfo(converter.getClass(), Converter.class);
|
ResolvableType[] typeInfo = getRequiredTypeInfo(converter.getClass(), Converter.class);
|
||||||
if (typeInfo == null && converter instanceof DecoratingProxy) {
|
if (typeInfo == null && converter instanceof DecoratingProxy decoratingProxy) {
|
||||||
typeInfo = getRequiredTypeInfo(((DecoratingProxy) converter).getDecoratedClass(), Converter.class);
|
typeInfo = getRequiredTypeInfo(decoratingProxy.getDecoratedClass(), Converter.class);
|
||||||
}
|
}
|
||||||
if (typeInfo == null) {
|
if (typeInfo == null) {
|
||||||
throw new IllegalArgumentException("Unable to determine source type <S> and target type <T> for your " +
|
throw new IllegalArgumentException("Unable to determine source type <S> and target type <T> for your " +
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor {
|
|||||||
if (supername != null && !isInterface(access)) {
|
if (supername != null && !isInterface(access)) {
|
||||||
this.superClassName = toClassName(supername);
|
this.superClassName = toClassName(supername);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < interfaces.length; i++) {
|
for (String element : interfaces) {
|
||||||
this.interfaceNames.add(toClassName(interfaces[i]));
|
this.interfaceNames.add(toClassName(element));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,21 +34,21 @@ class ParameterizedTypeReferenceTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void stringTypeReference() {
|
void stringTypeReference() {
|
||||||
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<>() {};
|
||||||
assertThat(typeReference.getType()).isEqualTo(String.class);
|
assertThat(typeReference.getType()).isEqualTo(String.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void mapTypeReference() throws Exception {
|
void mapTypeReference() throws Exception {
|
||||||
Type mapType = getClass().getMethod("mapMethod").getGenericReturnType();
|
Type mapType = getClass().getMethod("mapMethod").getGenericReturnType();
|
||||||
ParameterizedTypeReference<Map<Object,String>> typeReference = new ParameterizedTypeReference<Map<Object,String>>() {};
|
ParameterizedTypeReference<Map<Object,String>> typeReference = new ParameterizedTypeReference<>() {};
|
||||||
assertThat(typeReference.getType()).isEqualTo(mapType);
|
assertThat(typeReference.getType()).isEqualTo(mapType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void listTypeReference() throws Exception {
|
void listTypeReference() throws Exception {
|
||||||
Type listType = getClass().getMethod("listMethod").getGenericReturnType();
|
Type listType = getClass().getMethod("listMethod").getGenericReturnType();
|
||||||
ParameterizedTypeReference<List<String>> typeReference = new ParameterizedTypeReference<List<String>>() {};
|
ParameterizedTypeReference<List<String>> typeReference = new ParameterizedTypeReference<>() {};
|
||||||
assertThat(typeReference.getType()).isEqualTo(listType);
|
assertThat(typeReference.getType()).isEqualTo(listType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1096,10 +1096,9 @@ class DefaultConversionServiceTests {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (!(o instanceof SSN)) {
|
if (!(o instanceof SSN ssn)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SSN ssn = (SSN) o;
|
|
||||||
return this.value.equals(ssn.value);
|
return this.value.equals(ssn.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1137,10 +1136,9 @@ class DefaultConversionServiceTests {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (!(o instanceof ISBN)) {
|
if (!(o instanceof ISBN isbn)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ISBN isbn = (ISBN) o;
|
|
||||||
return this.value.equals(isbn.value);
|
return this.value.equals(isbn.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class CustomEnvironmentTests {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
protected Set<String> getReservedDefaultProfiles() {
|
protected Set<String> getReservedDefaultProfiles() {
|
||||||
return new HashSet<String>() {{
|
return new HashSet<>() {{
|
||||||
add("rd1");
|
add("rd1");
|
||||||
add("rd2");
|
add("rd2");
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ class PropertySourceTests {
|
|||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
void equals() {
|
void equals() {
|
||||||
Map<String, Object> map1 = new HashMap<String, Object>() {{
|
Map<String, Object> map1 = new HashMap<>() {{
|
||||||
put("a", "b");
|
put("a", "b");
|
||||||
}};
|
}};
|
||||||
Map<String, Object> map2 = new HashMap<String, Object>() {{
|
Map<String, Object> map2 = new HashMap<>() {{
|
||||||
put("c", "d");
|
put("c", "d");
|
||||||
}};
|
}};
|
||||||
Properties props1 = new Properties() {{
|
Properties props1 = new Properties() {{
|
||||||
@@ -69,10 +69,10 @@ class PropertySourceTests {
|
|||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
void collectionsOperations() {
|
void collectionsOperations() {
|
||||||
Map<String, Object> map1 = new HashMap<String, Object>() {{
|
Map<String, Object> map1 = new HashMap<>() {{
|
||||||
put("a", "b");
|
put("a", "b");
|
||||||
}};
|
}};
|
||||||
Map<String, Object> map2 = new HashMap<String, Object>() {{
|
Map<String, Object> map2 = new HashMap<>() {{
|
||||||
put("c", "d");
|
put("c", "d");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class FutureAdapterTests {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
void setUp() {
|
void setUp() {
|
||||||
adaptee = mock(Future.class);
|
adaptee = mock(Future.class);
|
||||||
adapter = new FutureAdapter<String, Integer>(adaptee) {
|
adapter = new FutureAdapter<>(adaptee) {
|
||||||
@Override
|
@Override
|
||||||
protected String adapt(Integer adapteeResult) throws ExecutionException {
|
protected String adapt(Integer adapteeResult) throws ExecutionException {
|
||||||
return adapteeResult.toString();
|
return adapteeResult.toString();
|
||||||
|
|||||||
@@ -41,10 +41,9 @@ public class TestPrincipal implements Principal {
|
|||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(obj instanceof TestPrincipal)) {
|
if (!(obj instanceof TestPrincipal p)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TestPrincipal p = (TestPrincipal) obj;
|
|
||||||
return this.name.equals(p.name);
|
return this.name.equals(p.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class LobSupportTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private AbstractLobStreamingResultSetExtractor<Void> getResultSetExtractor(final boolean ex) {
|
private AbstractLobStreamingResultSetExtractor<Void> getResultSetExtractor(final boolean ex) {
|
||||||
AbstractLobStreamingResultSetExtractor<Void> lobRse = new AbstractLobStreamingResultSetExtractor<Void>() {
|
AbstractLobStreamingResultSetExtractor<Void> lobRse = new AbstractLobStreamingResultSetExtractor<>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void streamData(ResultSet rs) throws SQLException, IOException {
|
protected void streamData(ResultSet rs) throws SQLException, IOException {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class SqlQueryTests {
|
|||||||
given(resultSet.next()).willReturn(true, false);
|
given(resultSet.next()).willReturn(true, false);
|
||||||
given(resultSet.getInt(1)).willReturn(1);
|
given(resultSet.getInt(1)).willReturn(1);
|
||||||
|
|
||||||
SqlQuery<Integer> query = new MappingSqlQueryWithParameters<Integer>() {
|
SqlQuery<Integer> query = new MappingSqlQueryWithParameters<>() {
|
||||||
@Override
|
@Override
|
||||||
protected Integer mapRow(ResultSet rs, int rownum, @Nullable Object[] params, @Nullable Map<? ,?> context)
|
protected Integer mapRow(ResultSet rs, int rownum, @Nullable Object[] params, @Nullable Map<? ,?> context)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
@@ -129,7 +129,7 @@ public class SqlQueryTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryWithoutEnoughParams() {
|
public void testQueryWithoutEnoughParams() {
|
||||||
MappingSqlQuery<Integer> query = new MappingSqlQuery<Integer>() {
|
MappingSqlQuery<Integer> query = new MappingSqlQuery<>() {
|
||||||
@Override
|
@Override
|
||||||
protected Integer mapRow(ResultSet rs, int rownum) throws SQLException {
|
protected Integer mapRow(ResultSet rs, int rownum) throws SQLException {
|
||||||
return rs.getInt(1);
|
return rs.getInt(1);
|
||||||
@@ -147,7 +147,7 @@ public class SqlQueryTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryWithMissingMapParams() {
|
public void testQueryWithMissingMapParams() {
|
||||||
MappingSqlQuery<Integer> query = new MappingSqlQuery<Integer>() {
|
MappingSqlQuery<Integer> query = new MappingSqlQuery<>() {
|
||||||
@Override
|
@Override
|
||||||
protected Integer mapRow(ResultSet rs, int rownum) throws SQLException {
|
protected Integer mapRow(ResultSet rs, int rownum) throws SQLException {
|
||||||
return rs.getInt(1);
|
return rs.getInt(1);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-2022 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.
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.springframework.jdbc.support;
|
package org.springframework.jdbc.support;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -69,12 +68,7 @@ class KeyHolderTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void getKeyWithMultipleKeysInMap() {
|
void getKeyWithMultipleKeysInMap() {
|
||||||
@SuppressWarnings("serial")
|
kh.getKeyList().add(Map.of("key", 1, "seq", 2));
|
||||||
Map<String, Object> m = new HashMap<String, Object>() {{
|
|
||||||
put("key", 1);
|
|
||||||
put("seq", 2);
|
|
||||||
}};
|
|
||||||
kh.getKeyList().add(m);
|
|
||||||
|
|
||||||
assertThat(kh.getKeys()).as("two keys should be in the map").hasSize(2);
|
assertThat(kh.getKeys()).as("two keys should be in the map").hasSize(2);
|
||||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||||
@@ -110,10 +104,7 @@ class KeyHolderTests {
|
|||||||
@Test
|
@Test
|
||||||
void getKeysWithMultipleKeyRows() {
|
void getKeysWithMultipleKeyRows() {
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
Map<String, Object> m = new HashMap<String, Object>() {{
|
Map<String, Object> m = Map.of("key", 1, "seq", 2);
|
||||||
put("key", 1);
|
|
||||||
put("seq", 2);
|
|
||||||
}};
|
|
||||||
kh.getKeyList().addAll(asList(m, m));
|
kh.getKeyList().addAll(asList(m, m));
|
||||||
|
|
||||||
assertThat(kh.getKeyList()).as("two rows should be in the list").hasSize(2);
|
assertThat(kh.getKeyList()).as("two rows should be in the list").hasSize(2);
|
||||||
|
|||||||
@@ -61,10 +61,9 @@ public class TestSimpSubscription implements SimpSubscription {
|
|||||||
if (this == other) {
|
if (this == other) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(other instanceof SimpSubscription)) {
|
if (!(other instanceof SimpSubscription otherSubscription)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
SimpSubscription otherSubscription = (SimpSubscription) other;
|
|
||||||
return (ObjectUtils.nullSafeEquals(getSession(), otherSubscription.getSession()) &&
|
return (ObjectUtils.nullSafeEquals(getSession(), otherSubscription.getSession()) &&
|
||||||
this.id.equals(otherSubscription.getId()));
|
this.id.equals(otherSubscription.getId()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,8 +89,7 @@ abstract class AbstractHttpRequestFactoryTests extends AbstractMockWebServerTest
|
|||||||
final byte[] body = "Hello World".getBytes(StandardCharsets.UTF_8);
|
final byte[] body = "Hello World".getBytes(StandardCharsets.UTF_8);
|
||||||
request.getHeaders().setContentLength(body.length);
|
request.getHeaders().setContentLength(body.length);
|
||||||
|
|
||||||
if (request instanceof StreamingHttpOutputMessage) {
|
if (request instanceof StreamingHttpOutputMessage streamingRequest) {
|
||||||
StreamingHttpOutputMessage streamingRequest = (StreamingHttpOutputMessage) request;
|
|
||||||
streamingRequest.setBody(outputStream -> StreamUtils.copy(body, outputStream));
|
streamingRequest.setBody(outputStream -> StreamUtils.copy(body, outputStream));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -111,8 +110,7 @@ abstract class AbstractHttpRequestFactoryTests extends AbstractMockWebServerTest
|
|||||||
ClientHttpRequest request = factory.createRequest(new URI(baseUrl + "/echo"), HttpMethod.POST);
|
ClientHttpRequest request = factory.createRequest(new URI(baseUrl + "/echo"), HttpMethod.POST);
|
||||||
|
|
||||||
final byte[] body = "Hello World".getBytes(StandardCharsets.UTF_8);
|
final byte[] body = "Hello World".getBytes(StandardCharsets.UTF_8);
|
||||||
if (request instanceof StreamingHttpOutputMessage) {
|
if (request instanceof StreamingHttpOutputMessage streamingRequest) {
|
||||||
StreamingHttpOutputMessage streamingRequest = (StreamingHttpOutputMessage) request;
|
|
||||||
streamingRequest.setBody(outputStream -> {
|
streamingRequest.setBody(outputStream -> {
|
||||||
StreamUtils.copy(body, outputStream);
|
StreamUtils.copy(body, outputStream);
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
|
|||||||
@@ -289,8 +289,7 @@ public class Jaxb2XmlDecoderTests extends AbstractLeakCheckingTests {
|
|||||||
if (this == o) {
|
if (this == o) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (o instanceof TypePojo) {
|
if (o instanceof TypePojo other) {
|
||||||
TypePojo other = (TypePojo) o;
|
|
||||||
return this.foo.equals(other.foo) && this.bar.equals(other.bar);
|
return this.foo.equals(other.foo) && this.bar.equals(other.bar);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class GsonHttpMessageConverterTests {
|
|||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void readAndWriteParameterizedType() throws Exception {
|
public void readAndWriteParameterizedType() throws Exception {
|
||||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<List<MyBean>>() {
|
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {
|
||||||
};
|
};
|
||||||
|
|
||||||
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||||
@@ -234,8 +234,8 @@ public class GsonHttpMessageConverterTests {
|
|||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void writeParameterizedBaseType() throws Exception {
|
public void writeParameterizedBaseType() throws Exception {
|
||||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<List<MyBean>>() {};
|
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||||
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<List<MyBase>>() {};
|
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<>() {};
|
||||||
|
|
||||||
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||||
"\"number\":42,\"string\":\"Foo\",\"bool\":true,\"fraction\":42.0}]";
|
"\"number\":42,\"string\":\"Foo\",\"bool\":true,\"fraction\":42.0}]";
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class JsonbHttpMessageConverterTests {
|
|||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void readAndWriteParameterizedType() throws Exception {
|
public void readAndWriteParameterizedType() throws Exception {
|
||||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<List<MyBean>>() {};
|
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||||
|
|
||||||
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||||
"\"number\":42,\"string\":\"Foo\",\"bool\":true,\"fraction\":42.0}]";
|
"\"number\":42,\"string\":\"Foo\",\"bool\":true,\"fraction\":42.0}]";
|
||||||
@@ -233,8 +233,8 @@ public class JsonbHttpMessageConverterTests {
|
|||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void writeParameterizedBaseType() throws Exception {
|
public void writeParameterizedBaseType() throws Exception {
|
||||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<List<MyBean>>() {};
|
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||||
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<List<MyBase>>() {};
|
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<>() {};
|
||||||
|
|
||||||
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||||
"\"number\":42,\"string\":\"Foo\",\"bool\":true,\"fraction\":42.0}]";
|
"\"number\":42,\"string\":\"Foo\",\"bool\":true,\"fraction\":42.0}]";
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ public class MappingJackson2HttpMessageConverterTests {
|
|||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void readAndWriteParameterizedType() throws Exception {
|
public void readAndWriteParameterizedType() throws Exception {
|
||||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<List<MyBean>>() {};
|
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||||
|
|
||||||
String body = "[{" +
|
String body = "[{" +
|
||||||
"\"bytes\":\"AQI=\"," +
|
"\"bytes\":\"AQI=\"," +
|
||||||
@@ -312,8 +312,8 @@ public class MappingJackson2HttpMessageConverterTests {
|
|||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void writeParameterizedBaseType() throws Exception {
|
public void writeParameterizedBaseType() throws Exception {
|
||||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<List<MyBean>>() {};
|
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||||
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<List<MyBase>>() {};
|
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<>() {};
|
||||||
|
|
||||||
String body = "[{" +
|
String body = "[{" +
|
||||||
"\"bytes\":\"AQI=\"," +
|
"\"bytes\":\"AQI=\"," +
|
||||||
@@ -468,7 +468,7 @@ public class MappingJackson2HttpMessageConverterTests {
|
|||||||
bar.setNumber(123);
|
bar.setNumber(123);
|
||||||
beans.add(bar);
|
beans.add(bar);
|
||||||
ParameterizedTypeReference<List<MyInterface>> typeReference =
|
ParameterizedTypeReference<List<MyInterface>> typeReference =
|
||||||
new ParameterizedTypeReference<List<MyInterface>>() {};
|
new ParameterizedTypeReference<>() {};
|
||||||
|
|
||||||
this.converter.writeInternal(beans, typeReference.getType(), outputMessage);
|
this.converter.writeInternal(beans, typeReference.getType(), outputMessage);
|
||||||
|
|
||||||
|
|||||||
@@ -224,8 +224,7 @@ public class Jaxb2CollectionHttpMessageConverterTests {
|
|||||||
if (this == o) {
|
if (this == o) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (o instanceof RootElement) {
|
if (o instanceof RootElement other) {
|
||||||
RootElement other = (RootElement) o;
|
|
||||||
return this.type.equals(other.type);
|
return this.type.equals(other.type);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -256,8 +255,7 @@ public class Jaxb2CollectionHttpMessageConverterTests {
|
|||||||
if (this == o) {
|
if (this == o) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (o instanceof TestType) {
|
if (o instanceof TestType other) {
|
||||||
TestType other = (TestType) o;
|
|
||||||
return this.s.equals(other.s);
|
return this.s.equals(other.s);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class ChannelSendOperatorTests {
|
|||||||
return Mono.never();
|
return Mono.never();
|
||||||
});
|
});
|
||||||
|
|
||||||
BaseSubscriber<Void> subscriber = new BaseSubscriber<Void>() {};
|
BaseSubscriber<Void> subscriber = new BaseSubscriber<>() {};
|
||||||
operator.subscribe(subscriber);
|
operator.subscribe(subscriber);
|
||||||
subscriber.cancel();
|
subscriber.cancel();
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class HttpMessageConverterExtractorTests {
|
|||||||
void generics() throws IOException {
|
void generics() throws IOException {
|
||||||
responseHeaders.setContentType(contentType);
|
responseHeaders.setContentType(contentType);
|
||||||
String expected = "Foo";
|
String expected = "Foo";
|
||||||
ParameterizedTypeReference<List<String>> reference = new ParameterizedTypeReference<List<String>>() {};
|
ParameterizedTypeReference<List<String>> reference = new ParameterizedTypeReference<>() {};
|
||||||
Type type = reference.getType();
|
Type type = reference.getType();
|
||||||
|
|
||||||
GenericHttpMessageConverter<String> converter = mock(GenericHttpMessageConverter.class);
|
GenericHttpMessageConverter<String> converter = mock(GenericHttpMessageConverter.class);
|
||||||
|
|||||||
@@ -115,8 +115,7 @@ class RestTemplateIntegrationTests extends AbstractMockWebServerTests {
|
|||||||
*/
|
*/
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
TestExecutionExceptionHandler serverErrorToAssertionErrorConverter = (context, throwable) -> {
|
TestExecutionExceptionHandler serverErrorToAssertionErrorConverter = (context, throwable) -> {
|
||||||
if (throwable instanceof HttpServerErrorException) {
|
if (throwable instanceof HttpServerErrorException ex) {
|
||||||
HttpServerErrorException ex = (HttpServerErrorException) throwable;
|
|
||||||
String responseBody = ex.getResponseBodyAsString();
|
String responseBody = ex.getResponseBodyAsString();
|
||||||
String prefix = AssertionError.class.getName() + ": ";
|
String prefix = AssertionError.class.getName() + ": ";
|
||||||
if (responseBody.startsWith(prefix)) {
|
if (responseBody.startsWith(prefix)) {
|
||||||
|
|||||||
@@ -646,7 +646,7 @@ class RestTemplateTests {
|
|||||||
void exchangeParameterizedType() throws Exception {
|
void exchangeParameterizedType() throws Exception {
|
||||||
GenericHttpMessageConverter converter = mock(GenericHttpMessageConverter.class);
|
GenericHttpMessageConverter converter = mock(GenericHttpMessageConverter.class);
|
||||||
template.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList(converter));
|
template.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList(converter));
|
||||||
ParameterizedTypeReference<List<Integer>> intList = new ParameterizedTypeReference<List<Integer>>() {};
|
ParameterizedTypeReference<List<Integer>> intList = new ParameterizedTypeReference<>() {};
|
||||||
given(converter.canRead(intList.getType(), null, null)).willReturn(true);
|
given(converter.canRead(intList.getType(), null, null)).willReturn(true);
|
||||||
given(converter.getSupportedMediaTypes(any())).willReturn(Collections.singletonList(MediaType.TEXT_PLAIN));
|
given(converter.getSupportedMediaTypes(any())).willReturn(Collections.singletonList(MediaType.TEXT_PLAIN));
|
||||||
given(converter.canWrite(String.class, String.class, null)).willReturn(true);
|
given(converter.canWrite(String.class, String.class, null)).willReturn(true);
|
||||||
|
|||||||
@@ -52,8 +52,7 @@ public abstract class AbstractHttpHandlerIntegrationTests {
|
|||||||
*/
|
*/
|
||||||
@RegisterExtension
|
@RegisterExtension
|
||||||
TestExecutionExceptionHandler serverErrorToAssertionErrorConverter = (context, throwable) -> {
|
TestExecutionExceptionHandler serverErrorToAssertionErrorConverter = (context, throwable) -> {
|
||||||
if (throwable instanceof HttpServerErrorException) {
|
if (throwable instanceof HttpServerErrorException ex) {
|
||||||
HttpServerErrorException ex = (HttpServerErrorException) throwable;
|
|
||||||
String responseBody = ex.getResponseBodyAsString();
|
String responseBody = ex.getResponseBodyAsString();
|
||||||
if (StringUtils.hasText(responseBody)) {
|
if (StringUtils.hasText(responseBody)) {
|
||||||
String prefix = AssertionError.class.getName() + ": ";
|
String prefix = AssertionError.class.getName() + ": ";
|
||||||
|
|||||||
@@ -1282,8 +1282,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
|||||||
|
|
||||||
public void setSession(HttpSession session) {
|
public void setSession(HttpSession session) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
if (session instanceof MockHttpSession) {
|
if (session instanceof MockHttpSession mockSession) {
|
||||||
MockHttpSession mockSession = ((MockHttpSession) session);
|
|
||||||
mockSession.access();
|
mockSession.access();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -447,8 +447,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
|||||||
if (cookie.isHttpOnly()) {
|
if (cookie.isHttpOnly()) {
|
||||||
buf.append("; HttpOnly");
|
buf.append("; HttpOnly");
|
||||||
}
|
}
|
||||||
if (cookie instanceof MockCookie) {
|
if (cookie instanceof MockCookie mockCookie) {
|
||||||
MockCookie mockCookie = (MockCookie) cookie;
|
|
||||||
if (StringUtils.hasText(mockCookie.getSameSite())) {
|
if (StringUtils.hasText(mockCookie.getSameSite())) {
|
||||||
buf.append("; SameSite=").append(mockCookie.getSameSite());
|
buf.append("; SameSite=").append(mockCookie.getSameSite());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ public class Pojo {
|
|||||||
if (this == o) {
|
if (this == o) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (o instanceof Pojo) {
|
if (o instanceof Pojo other) {
|
||||||
Pojo other = (Pojo) o;
|
|
||||||
return this.foo.equals(other.foo) && this.bar.equals(other.bar);
|
return this.foo.equals(other.foo) && this.bar.equals(other.bar);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public class DefaultClientRequestBuilderTests {
|
|||||||
public void bodyParameterizedTypeReference() {
|
public void bodyParameterizedTypeReference() {
|
||||||
String body = "foo";
|
String body = "foo";
|
||||||
Publisher<String> publisher = Mono.just(body);
|
Publisher<String> publisher = Mono.just(body);
|
||||||
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<>() {};
|
||||||
ClientRequest result = ClientRequest.create(POST, DEFAULT_URL).body(publisher, typeReference).build();
|
ClientRequest result = ClientRequest.create(POST, DEFAULT_URL).body(publisher, typeReference).build();
|
||||||
|
|
||||||
List<HttpMessageWriter<?>> messageWriters = new ArrayList<>();
|
List<HttpMessageWriter<?>> messageWriters = new ArrayList<>();
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public class ClientResponseWrapperTests {
|
|||||||
@Test
|
@Test
|
||||||
public void bodyToMonoParameterizedTypeReference() {
|
public void bodyToMonoParameterizedTypeReference() {
|
||||||
Mono<String> result = Mono.just("foo");
|
Mono<String> result = Mono.just("foo");
|
||||||
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<>() {};
|
||||||
given(mockResponse.bodyToMono(reference)).willReturn(result);
|
given(mockResponse.bodyToMono(reference)).willReturn(result);
|
||||||
|
|
||||||
assertThat(wrapper.bodyToMono(reference)).isSameAs(result);
|
assertThat(wrapper.bodyToMono(reference)).isSameAs(result);
|
||||||
@@ -128,7 +128,7 @@ public class ClientResponseWrapperTests {
|
|||||||
@Test
|
@Test
|
||||||
public void bodyToFluxParameterizedTypeReference() {
|
public void bodyToFluxParameterizedTypeReference() {
|
||||||
Flux<String> result = Flux.just("foo");
|
Flux<String> result = Flux.just("foo");
|
||||||
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<>() {};
|
||||||
given(mockResponse.bodyToFlux(reference)).willReturn(result);
|
given(mockResponse.bodyToFlux(reference)).willReturn(result);
|
||||||
|
|
||||||
assertThat(wrapper.bodyToFlux(reference)).isSameAs(result);
|
assertThat(wrapper.bodyToFlux(reference)).isSameAs(result);
|
||||||
@@ -145,7 +145,7 @@ public class ClientResponseWrapperTests {
|
|||||||
@Test
|
@Test
|
||||||
public void toEntityParameterizedTypeReference() {
|
public void toEntityParameterizedTypeReference() {
|
||||||
Mono<ResponseEntity<String>> result = Mono.just(new ResponseEntity<>("foo", HttpStatus.OK));
|
Mono<ResponseEntity<String>> result = Mono.just(new ResponseEntity<>("foo", HttpStatus.OK));
|
||||||
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<>() {};
|
||||||
given(mockResponse.toEntity(reference)).willReturn(result);
|
given(mockResponse.toEntity(reference)).willReturn(result);
|
||||||
|
|
||||||
assertThat(wrapper.toEntity(reference)).isSameAs(result);
|
assertThat(wrapper.toEntity(reference)).isSameAs(result);
|
||||||
@@ -162,7 +162,7 @@ public class ClientResponseWrapperTests {
|
|||||||
@Test
|
@Test
|
||||||
public void toEntityListParameterizedTypeReference() {
|
public void toEntityListParameterizedTypeReference() {
|
||||||
Mono<ResponseEntity<List<String>>> result = Mono.just(new ResponseEntity<>(singletonList("foo"), HttpStatus.OK));
|
Mono<ResponseEntity<List<String>>> result = Mono.just(new ResponseEntity<>(singletonList("foo"), HttpStatus.OK));
|
||||||
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<>() {};
|
||||||
given(mockResponse.toEntityList(reference)).willReturn(result);
|
given(mockResponse.toEntityList(reference)).willReturn(result);
|
||||||
|
|
||||||
assertThat(wrapper.toEntityList(reference)).isSameAs(result);
|
assertThat(wrapper.toEntityList(reference)).isSameAs(result);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class DefaultEntityResponseBuilderTests {
|
|||||||
@Test
|
@Test
|
||||||
public void fromPublisher() {
|
public void fromPublisher() {
|
||||||
Flux<String> body = Flux.just("foo", "bar");
|
Flux<String> body = Flux.just("foo", "bar");
|
||||||
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<>() {};
|
||||||
EntityResponse<Flux<String>> response = EntityResponse.fromPublisher(body, typeReference).build().block();
|
EntityResponse<Flux<String>> response = EntityResponse.fromPublisher(body, typeReference).build().block();
|
||||||
assertThat(response.entity()).isSameAs(body);
|
assertThat(response.entity()).isSameAs(body);
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ public class DefaultEntityResponseBuilderTests {
|
|||||||
@Test
|
@Test
|
||||||
public void fromProducer() {
|
public void fromProducer() {
|
||||||
Single<String> body = Single.just("foo");
|
Single<String> body = Single.just("foo");
|
||||||
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<>() {};
|
||||||
EntityResponse<Single<String>> response = EntityResponse.fromProducer(body, typeReference).build().block();
|
EntityResponse<Single<String>> response = EntityResponse.fromProducer(body, typeReference).build().block();
|
||||||
assertThat(response.entity()).isSameAs(body);
|
assertThat(response.entity()).isSameAs(body);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ public class DefaultServerRequestTests {
|
|||||||
.body(body);
|
.body(body);
|
||||||
DefaultServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), messageReaders);
|
DefaultServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), messageReaders);
|
||||||
|
|
||||||
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<>() {};
|
||||||
Mono<String> resultMono = request.bodyToMono(typeReference);
|
Mono<String> resultMono = request.bodyToMono(typeReference);
|
||||||
assertThat(resultMono.block()).isEqualTo("foo");
|
assertThat(resultMono.block()).isEqualTo("foo");
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@ public class DefaultServerRequestTests {
|
|||||||
.body(body);
|
.body(body);
|
||||||
DefaultServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), messageReaders);
|
DefaultServerRequest request = new DefaultServerRequest(MockServerWebExchange.from(mockRequest), messageReaders);
|
||||||
|
|
||||||
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> typeReference = new ParameterizedTypeReference<>() {};
|
||||||
Flux<String> resultFlux = request.bodyToFlux(typeReference);
|
Flux<String> resultFlux = request.bodyToFlux(typeReference);
|
||||||
assertThat(resultFlux.collectList().block()).isEqualTo(Collections.singletonList("foo"));
|
assertThat(resultFlux.collectList().block()).isEqualTo(Collections.singletonList("foo"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegrationTe
|
|||||||
void flux(HttpServer httpServer) throws Exception {
|
void flux(HttpServer httpServer) throws Exception {
|
||||||
startServer(httpServer);
|
startServer(httpServer);
|
||||||
|
|
||||||
ParameterizedTypeReference<List<Person>> reference = new ParameterizedTypeReference<List<Person>>() {};
|
ParameterizedTypeReference<List<Person>> reference = new ParameterizedTypeReference<>() {};
|
||||||
ResponseEntity<List<Person>> result =
|
ResponseEntity<List<Person>> result =
|
||||||
this.restTemplate
|
this.restTemplate
|
||||||
.exchange("http://localhost:" + this.port + "/flux", HttpMethod.GET, null, reference);
|
.exchange("http://localhost:" + this.port + "/flux", HttpMethod.GET, null, reference);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class PublisherHandlerFunctionIntegrationTests extends AbstractRouterFunctionInt
|
|||||||
void flux(HttpServer httpServer) throws Exception {
|
void flux(HttpServer httpServer) throws Exception {
|
||||||
startServer(httpServer);
|
startServer(httpServer);
|
||||||
|
|
||||||
ParameterizedTypeReference<List<Person>> reference = new ParameterizedTypeReference<List<Person>>() {};
|
ParameterizedTypeReference<List<Person>> reference = new ParameterizedTypeReference<>() {};
|
||||||
ResponseEntity<List<Person>> result =
|
ResponseEntity<List<Person>> result =
|
||||||
restTemplate.exchange("http://localhost:" + super.port + "/flux", HttpMethod.GET, null, reference);
|
restTemplate.exchange("http://localhost:" + super.port + "/flux", HttpMethod.GET, null, reference);
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class ServerRequestWrapperTests {
|
|||||||
@Test
|
@Test
|
||||||
public void bodyToMonoParameterizedTypeReference() {
|
public void bodyToMonoParameterizedTypeReference() {
|
||||||
Mono<String> result = Mono.just("foo");
|
Mono<String> result = Mono.just("foo");
|
||||||
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<>() {};
|
||||||
given(mockRequest.bodyToMono(reference)).willReturn(result);
|
given(mockRequest.bodyToMono(reference)).willReturn(result);
|
||||||
|
|
||||||
assertThat(wrapper.bodyToMono(reference)).isSameAs(result);
|
assertThat(wrapper.bodyToMono(reference)).isSameAs(result);
|
||||||
@@ -176,7 +176,7 @@ public class ServerRequestWrapperTests {
|
|||||||
@Test
|
@Test
|
||||||
public void bodyToFluxParameterizedTypeReference() {
|
public void bodyToFluxParameterizedTypeReference() {
|
||||||
Flux<String> result = Flux.just("foo");
|
Flux<String> result = Flux.just("foo");
|
||||||
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<String>() {};
|
ParameterizedTypeReference<String> reference = new ParameterizedTypeReference<>() {};
|
||||||
given(mockRequest.bodyToFlux(reference)).willReturn(result);
|
given(mockRequest.bodyToFlux(reference)).willReturn(result);
|
||||||
|
|
||||||
assertThat(wrapper.bodyToFlux(reference)).isSameAs(result);
|
assertThat(wrapper.bodyToFlux(reference)).isSameAs(result);
|
||||||
|
|||||||
@@ -353,8 +353,7 @@ public class MessageReaderArgumentResolverTests {
|
|||||||
if (this == o) {
|
if (this == o) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (o instanceof TestBean) {
|
if (o instanceof TestBean other) {
|
||||||
TestBean other = (TestBean) o;
|
|
||||||
return this.foo.equals(other.foo) && this.bar.equals(other.bar);
|
return this.foo.equals(other.foo) && this.bar.equals(other.bar);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ import static org.springframework.http.MediaType.APPLICATION_XML;
|
|||||||
public class RequestMappingMessageConversionIntegrationTests extends AbstractRequestMappingIntegrationTests {
|
public class RequestMappingMessageConversionIntegrationTests extends AbstractRequestMappingIntegrationTests {
|
||||||
|
|
||||||
private static final ParameterizedTypeReference<List<Person>> PERSON_LIST =
|
private static final ParameterizedTypeReference<List<Person>> PERSON_LIST =
|
||||||
new ParameterizedTypeReference<List<Person>>() {};
|
new ParameterizedTypeReference<>() {};
|
||||||
|
|
||||||
private static final MediaType JSON = MediaType.APPLICATION_JSON;
|
private static final MediaType JSON = MediaType.APPLICATION_JSON;
|
||||||
|
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ class ContextLoaderTests {
|
|||||||
@Override
|
@Override
|
||||||
public void initialize(ConfigurableApplicationContext applicationContext) {
|
public void initialize(ConfigurableApplicationContext applicationContext) {
|
||||||
ConfigurableEnvironment environment = applicationContext.getEnvironment();
|
ConfigurableEnvironment environment = applicationContext.getEnvironment();
|
||||||
environment.getPropertySources().addFirst(new PropertySource<Object>("testPropertySource") {
|
environment.getPropertySources().addFirst(new PropertySource<>("testPropertySource") {
|
||||||
@Override
|
@Override
|
||||||
public Object getProperty(String key) {
|
public Object getProperty(String key) {
|
||||||
return "name".equals(key) ? "testName" : null;
|
return "name".equals(key) ? "testName" : null;
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public class XmlWebApplicationContextTests extends AbstractApplicationContextTes
|
|||||||
root.addBeanFactoryPostProcessor(beanFactory -> beanFactory.addBeanPostProcessor(new BeanPostProcessor() {
|
root.addBeanFactoryPostProcessor(beanFactory -> beanFactory.addBeanPostProcessor(new BeanPostProcessor() {
|
||||||
@Override
|
@Override
|
||||||
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException {
|
||||||
if (bean instanceof TestBean) {
|
if (bean instanceof TestBean testBean) {
|
||||||
((TestBean) bean).getFriends().add("myFriend");
|
testBean.getFriends().add("myFriend");
|
||||||
}
|
}
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,8 +182,7 @@ public class InterceptorRegistryTests {
|
|||||||
PathMatcher pathMatcher = new AntPathMatcher();
|
PathMatcher pathMatcher = new AntPathMatcher();
|
||||||
List<HandlerInterceptor> result = new ArrayList<>();
|
List<HandlerInterceptor> result = new ArrayList<>();
|
||||||
for (Object interceptor : this.registry.getInterceptors()) {
|
for (Object interceptor : this.registry.getInterceptors()) {
|
||||||
if (interceptor instanceof MappedInterceptor) {
|
if (interceptor instanceof MappedInterceptor mappedInterceptor) {
|
||||||
MappedInterceptor mappedInterceptor = (MappedInterceptor) interceptor;
|
|
||||||
if (mappedInterceptor.matches(lookupPath, pathMatcher)) {
|
if (mappedInterceptor.matches(lookupPath, pathMatcher)) {
|
||||||
result.add(mappedInterceptor.getInterceptor());
|
result.add(mappedInterceptor.getInterceptor());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,8 +83,7 @@ public class LocaleResolverTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check LocaleContext
|
// check LocaleContext
|
||||||
if (localeResolver instanceof LocaleContextResolver) {
|
if (localeResolver instanceof LocaleContextResolver localeContextResolver) {
|
||||||
LocaleContextResolver localeContextResolver = (LocaleContextResolver) localeResolver;
|
|
||||||
LocaleContext localeContext = localeContextResolver.resolveLocaleContext(request);
|
LocaleContext localeContext = localeContextResolver.resolveLocaleContext(request);
|
||||||
if (shouldSet) {
|
if (shouldSet) {
|
||||||
assertThat(localeContext.getLocale()).isEqualTo(Locale.GERMANY);
|
assertThat(localeContext.getLocale()).isEqualTo(Locale.GERMANY);
|
||||||
|
|||||||
@@ -46,10 +46,9 @@ public class ItemPet {
|
|||||||
if (this == other) {
|
if (this == other) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(other instanceof ItemPet)) {
|
if (!(other instanceof ItemPet otherPet)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ItemPet otherPet = (ItemPet) other;
|
|
||||||
return (this.name != null && this.name.equals(otherPet.getName()));
|
return (this.name != null && this.name.equals(otherPet.getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -556,8 +556,7 @@ class OptionTagTests extends AbstractHtmlElementTagTests {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof RulesVariant) {
|
if (obj instanceof RulesVariant other) {
|
||||||
RulesVariant other = (RulesVariant) obj;
|
|
||||||
return this.toId().equals(other.toId());
|
return this.toId().equals(other.toId());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public class UndertowTestServer implements WebSocketTestServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InstanceHandle<Servlet> createInstance() throws InstantiationException {
|
public InstanceHandle<Servlet> createInstance() throws InstantiationException {
|
||||||
return new InstanceHandle<Servlet>() {
|
return new InstanceHandle<>() {
|
||||||
@Override
|
@Override
|
||||||
public Servlet getInstance() {
|
public Servlet getInstance() {
|
||||||
return new DispatcherServlet(wac);
|
return new DispatcherServlet(wac);
|
||||||
@@ -167,7 +167,7 @@ public class UndertowTestServer implements WebSocketTestServer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InstanceHandle<Filter> createInstance() throws InstantiationException {
|
public InstanceHandle<Filter> createInstance() throws InstantiationException {
|
||||||
return new InstanceHandle<Filter>() {
|
return new InstanceHandle<>() {
|
||||||
@Override
|
@Override
|
||||||
public Filter getInstance() {
|
public Filter getInstance() {
|
||||||
return filter;
|
return filter;
|
||||||
|
|||||||
Reference in New Issue
Block a user