Polishing
This commit is contained in:
@@ -66,7 +66,7 @@ class GenericTypeResolverTests {
|
||||
@Test
|
||||
void nullIfNotResolvable() {
|
||||
GenericClass<String> obj = new GenericClass<>();
|
||||
assertThat((Object) resolveTypeArgument(obj.getClass(), GenericClass.class)).isNull();
|
||||
assertThat(resolveTypeArgument(obj.getClass(), GenericClass.class)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -148,13 +148,13 @@ class GenericTypeResolverTests {
|
||||
@Test // SPR-11030
|
||||
void getGenericsCannotBeResolved() {
|
||||
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(List.class, Iterable.class);
|
||||
assertThat((Object) resolved).isNull();
|
||||
assertThat(resolved).isNull();
|
||||
}
|
||||
|
||||
@Test // SPR-11052
|
||||
void getRawMapTypeCannotBeResolved() {
|
||||
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(Map.class, Map.class);
|
||||
assertThat((Object) resolved).isNull();
|
||||
assertThat(resolved).isNull();
|
||||
}
|
||||
|
||||
@Test // SPR-11044
|
||||
@@ -377,16 +377,16 @@ class GenericTypeResolverTests {
|
||||
interface IdFixingRepository<T> extends Repository<T, Long> {
|
||||
}
|
||||
|
||||
interface First<F extends Number> {
|
||||
interface First<N extends Number> {
|
||||
|
||||
default void foo(F f) {
|
||||
default void foo(N f) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
interface Second<B> {
|
||||
interface Second<T> {
|
||||
|
||||
default void bar(B b) {
|
||||
default void bar(T b) {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,8 +321,8 @@ class AnnotationUtilsTests {
|
||||
@Test
|
||||
void findAnnotationDeclaringClassForAllScenarios() {
|
||||
// no class-level annotation
|
||||
assertThat((Object) findAnnotationDeclaringClass(Transactional.class, NonAnnotatedInterface.class)).isNull();
|
||||
assertThat((Object) findAnnotationDeclaringClass(Transactional.class, NonAnnotatedClass.class)).isNull();
|
||||
assertThat(findAnnotationDeclaringClass(Transactional.class, NonAnnotatedInterface.class)).isNull();
|
||||
assertThat(findAnnotationDeclaringClass(Transactional.class, NonAnnotatedClass.class)).isNull();
|
||||
|
||||
// inherited class-level annotation; note: @Transactional is inherited
|
||||
assertThat(findAnnotationDeclaringClass(Transactional.class, InheritedAnnotationInterface.class)).isEqualTo(InheritedAnnotationInterface.class);
|
||||
@@ -342,8 +342,8 @@ class AnnotationUtilsTests {
|
||||
void findAnnotationDeclaringClassForTypesWithSingleCandidateType() {
|
||||
// no class-level annotation
|
||||
List<Class<? extends Annotation>> transactionalCandidateList = Collections.singletonList(Transactional.class);
|
||||
assertThat((Object) findAnnotationDeclaringClassForTypes(transactionalCandidateList, NonAnnotatedInterface.class)).isNull();
|
||||
assertThat((Object) findAnnotationDeclaringClassForTypes(transactionalCandidateList, NonAnnotatedClass.class)).isNull();
|
||||
assertThat(findAnnotationDeclaringClassForTypes(transactionalCandidateList, NonAnnotatedInterface.class)).isNull();
|
||||
assertThat(findAnnotationDeclaringClassForTypes(transactionalCandidateList, NonAnnotatedClass.class)).isNull();
|
||||
|
||||
// inherited class-level annotation; note: @Transactional is inherited
|
||||
assertThat(findAnnotationDeclaringClassForTypes(transactionalCandidateList, InheritedAnnotationInterface.class)).isEqualTo(InheritedAnnotationInterface.class);
|
||||
@@ -365,8 +365,8 @@ class AnnotationUtilsTests {
|
||||
List<Class<? extends Annotation>> candidates = asList(Transactional.class, Order.class);
|
||||
|
||||
// no class-level annotation
|
||||
assertThat((Object) findAnnotationDeclaringClassForTypes(candidates, NonAnnotatedInterface.class)).isNull();
|
||||
assertThat((Object) findAnnotationDeclaringClassForTypes(candidates, NonAnnotatedClass.class)).isNull();
|
||||
assertThat(findAnnotationDeclaringClassForTypes(candidates, NonAnnotatedInterface.class)).isNull();
|
||||
assertThat(findAnnotationDeclaringClassForTypes(candidates, NonAnnotatedClass.class)).isNull();
|
||||
|
||||
// inherited class-level annotation; note: @Transactional is inherited
|
||||
assertThat(findAnnotationDeclaringClassForTypes(candidates, InheritedAnnotationInterface.class)).isEqualTo(InheritedAnnotationInterface.class);
|
||||
|
||||
@@ -862,7 +862,7 @@ class DefaultConversionServiceTests {
|
||||
void convertObjectToObjectFinderMethodWithNull() {
|
||||
TestEntity entity = (TestEntity) conversionService.convert(null,
|
||||
TypeDescriptor.valueOf(String.class), TypeDescriptor.valueOf(TestEntity.class));
|
||||
assertThat((Object) entity).isNull();
|
||||
assertThat(entity).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -99,12 +99,12 @@ class MutablePropertySourcesTests {
|
||||
assertThat(sources).hasSize(6);
|
||||
assertThat(sources.contains("a")).isFalse();
|
||||
|
||||
assertThat((Object) sources.remove("a")).isNull();
|
||||
assertThat(sources.remove("a")).isNull();
|
||||
assertThat(sources).hasSize(6);
|
||||
|
||||
String bogusPS = "bogus";
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
sources.addAfter(bogusPS, new MockPropertySource("h")))
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> sources.addAfter(bogusPS, new MockPropertySource("h")))
|
||||
.withMessageContaining("does not exist");
|
||||
|
||||
sources.addFirst(new MockPropertySource("a"));
|
||||
@@ -121,16 +121,16 @@ class MutablePropertySourcesTests {
|
||||
|
||||
sources.replace("a-replaced", new MockPropertySource("a"));
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
sources.replace(bogusPS, new MockPropertySource("bogus-replaced")))
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> sources.replace(bogusPS, new MockPropertySource("bogus-replaced")))
|
||||
.withMessageContaining("does not exist");
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
sources.addBefore("b", new MockPropertySource("b")))
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> sources.addBefore("b", new MockPropertySource("b")))
|
||||
.withMessageContaining("cannot be added relative to itself");
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
sources.addAfter("b", new MockPropertySource("b")))
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> sources.addAfter("b", new MockPropertySource("b")))
|
||||
.withMessageContaining("cannot be added relative to itself");
|
||||
}
|
||||
|
||||
@@ -149,8 +149,7 @@ class MutablePropertySourcesTests {
|
||||
assertThat(it.hasNext()).isTrue();
|
||||
assertThat(it.next().getName()).isEqualTo("test");
|
||||
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(
|
||||
it::remove);
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(it::remove);
|
||||
assertThat(it.hasNext()).isFalse();
|
||||
}
|
||||
|
||||
|
||||
@@ -522,10 +522,6 @@ class ConcurrentReferenceHashMapTests {
|
||||
super(initialCapacity, loadFactor, concurrencyLevel);
|
||||
}
|
||||
|
||||
public TestWeakConcurrentCache(int initialCapacity, int concurrencyLevel) {
|
||||
super(initialCapacity, concurrencyLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHash(@Nullable Object o) {
|
||||
// For testing we want more control of the hash
|
||||
|
||||
@@ -73,7 +73,7 @@ class ReflectionUtilsTests {
|
||||
assertThat(testBean.getName()).isEqualTo("FooBar");
|
||||
|
||||
ReflectionUtils.setField(field, testBean, null);
|
||||
assertThat((Object) testBean.getName()).isNull();
|
||||
assertThat(testBean.getName()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -221,7 +221,7 @@ class SettableListenableFutureTests {
|
||||
@Test
|
||||
void nullIsAcceptedAsValueToSet() throws ExecutionException, InterruptedException {
|
||||
settableListenableFuture.set(null);
|
||||
assertThat((Object) settableListenableFuture.get()).isNull();
|
||||
assertThat(settableListenableFuture.get()).isNull();
|
||||
assertThat(settableListenableFuture.isCancelled()).isFalse();
|
||||
assertThat(settableListenableFuture.isDone()).isTrue();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class StaxSourceTests {
|
||||
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(XML));
|
||||
StaxSource source = new StaxSource(streamReader);
|
||||
assertThat(source.getXMLStreamReader()).as("Invalid streamReader returned").isEqualTo(streamReader);
|
||||
assertThat((Object) source.getXMLEventReader()).as("EventReader returned").isNull();
|
||||
assertThat(source.getXMLEventReader()).as("EventReader returned").isNull();
|
||||
StringWriter writer = new StringWriter();
|
||||
transformer.transform(source, new StreamResult(writer));
|
||||
assertThat(XmlContent.from(writer)).as("Invalid result").isSimilarTo(XML);
|
||||
@@ -77,7 +77,7 @@ class StaxSourceTests {
|
||||
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(XML));
|
||||
StaxSource source = new StaxSource(streamReader);
|
||||
assertThat(source.getXMLStreamReader()).as("Invalid streamReader returned").isEqualTo(streamReader);
|
||||
assertThat((Object) source.getXMLEventReader()).as("EventReader returned").isNull();
|
||||
assertThat(source.getXMLEventReader()).as("EventReader returned").isNull();
|
||||
|
||||
Document expected = documentBuilder.parse(new InputSource(new StringReader(XML)));
|
||||
Document result = documentBuilder.newDocument();
|
||||
@@ -89,7 +89,7 @@ class StaxSourceTests {
|
||||
void eventReaderSourceToStreamResult() throws Exception {
|
||||
XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(XML));
|
||||
StaxSource source = new StaxSource(eventReader);
|
||||
assertThat((Object) source.getXMLEventReader()).as("Invalid eventReader returned").isEqualTo(eventReader);
|
||||
assertThat(source.getXMLEventReader()).as("Invalid eventReader returned").isEqualTo(eventReader);
|
||||
assertThat(source.getXMLStreamReader()).as("StreamReader returned").isNull();
|
||||
StringWriter writer = new StringWriter();
|
||||
transformer.transform(source, new StreamResult(writer));
|
||||
@@ -100,7 +100,7 @@ class StaxSourceTests {
|
||||
void eventReaderSourceToDOMResult() throws Exception {
|
||||
XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(XML));
|
||||
StaxSource source = new StaxSource(eventReader);
|
||||
assertThat((Object) source.getXMLEventReader()).as("Invalid eventReader returned").isEqualTo(eventReader);
|
||||
assertThat(source.getXMLEventReader()).as("Invalid eventReader returned").isEqualTo(eventReader);
|
||||
assertThat(source.getXMLStreamReader()).as("StreamReader returned").isNull();
|
||||
|
||||
Document expected = documentBuilder.parse(new InputSource(new StringReader(XML)));
|
||||
@@ -108,4 +108,5 @@ class StaxSourceTests {
|
||||
transformer.transform(source, new DOMResult(result));
|
||||
assertThat(XmlContent.of(result)).as("Invalid result").isSimilarTo(expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user