Use modern language features in tests
This commit is contained in:
@@ -195,14 +195,22 @@ public class PagedListHolderTests {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MockFilter)) return false;
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof MockFilter mockFilter)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final MockFilter mockFilter = (MockFilter) o;
|
||||
|
||||
if (!age.equals(mockFilter.age)) return false;
|
||||
if (!extendedInfo.equals(mockFilter.extendedInfo)) return false;
|
||||
if (!name.equals(mockFilter.name)) return false;
|
||||
if (!age.equals(mockFilter.age)) {
|
||||
return false;
|
||||
}
|
||||
if (!extendedInfo.equals(mockFilter.extendedInfo)) {
|
||||
return false;
|
||||
}
|
||||
if (!name.equals(mockFilter.name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,10 +44,9 @@ public class NestedTestBean implements INestedTestBean {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof NestedTestBean)) {
|
||||
if (!(obj instanceof NestedTestBean ntb)) {
|
||||
return false;
|
||||
}
|
||||
NestedTestBean ntb = (NestedTestBean) obj;
|
||||
return this.company.equals(ntb.company);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,10 +64,9 @@ public class SerializablePerson implements Person, Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof SerializablePerson)) {
|
||||
if (!(other instanceof SerializablePerson p)) {
|
||||
return false;
|
||||
}
|
||||
SerializablePerson p = (SerializablePerson) other;
|
||||
return p.age == age && ObjectUtils.nullSafeEquals(name, p.name);
|
||||
}
|
||||
|
||||
|
||||
@@ -468,10 +468,9 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof TestBean)) {
|
||||
if (!(other instanceof TestBean tb2)) {
|
||||
return false;
|
||||
}
|
||||
TestBean tb2 = (TestBean) other;
|
||||
return (ObjectUtils.nullSafeEquals(this.name, tb2.name) && this.age == tb2.age);
|
||||
}
|
||||
|
||||
|
||||
@@ -261,11 +261,9 @@ public abstract class AbstractBeanFactoryTests {
|
||||
@Test
|
||||
public void aliasing() {
|
||||
BeanFactory bf = getBeanFactory();
|
||||
if (!(bf instanceof ConfigurableBeanFactory)) {
|
||||
if (!(bf instanceof ConfigurableBeanFactory cbf)) {
|
||||
return;
|
||||
}
|
||||
ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) bf;
|
||||
|
||||
String alias = "rods alias";
|
||||
|
||||
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() ->
|
||||
|
||||
Reference in New Issue
Block a user