DATACMNS-867 - Additional Java 8 language feature cleanup.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters. Additionally remove unused imports and replace single element list initialization with dedicated singletonList. Use Assertion overloads taking Supplier for dynamic assertion error messages.
This commit is contained in:
committed by
Oliver Gierke
parent
aa4c51e1ea
commit
be347eaaab
@@ -60,7 +60,7 @@ public class MapAccessingMethodInterceptorUnitTests {
|
||||
@Test // DATACMNS-630
|
||||
public void setterInvocationStoresValueInMap() throws Throwable {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
when(invocation.getMethod()).thenReturn(Sample.class.getMethod("setName", String.class));
|
||||
when(invocation.getArguments()).thenReturn(new Object[] { "Foo" });
|
||||
@@ -74,7 +74,7 @@ public class MapAccessingMethodInterceptorUnitTests {
|
||||
@Test // DATACMNS-630
|
||||
public void getterInvocationReturnsValueFromMap() throws Throwable {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("name", "Foo");
|
||||
|
||||
when(invocation.getMethod()).thenReturn(Sample.class.getMethod("getName"));
|
||||
@@ -87,7 +87,7 @@ public class MapAccessingMethodInterceptorUnitTests {
|
||||
@Test // DATACMNS-630
|
||||
public void getterReturnsNullIfMapDoesNotContainValue() throws Throwable {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
when(invocation.getMethod()).thenReturn(Sample.class.getMethod("getName"));
|
||||
|
||||
@@ -98,7 +98,7 @@ public class MapAccessingMethodInterceptorUnitTests {
|
||||
public void rejectsNonAccessorInvocation() throws Throwable {
|
||||
|
||||
when(invocation.getMethod()).thenReturn(Sample.class.getMethod("someMethod"));
|
||||
new MapAccessingMethodInterceptor(Collections.<String, Object> emptyMap()).invoke(invocation);
|
||||
new MapAccessingMethodInterceptor(Collections.emptyMap()).invoke(invocation);
|
||||
}
|
||||
|
||||
interface Sample {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.data.projection;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -94,11 +94,11 @@ public class ProxyProjectionFactoryUnitTests {
|
||||
@Test // DATACMNS-630
|
||||
public void createsMapBasedProxyFromSource() {
|
||||
|
||||
HashMap<String, Object> addressSource = new HashMap<String, Object>();
|
||||
HashMap<String, Object> addressSource = new HashMap<>();
|
||||
addressSource.put("zipCode", "ZIP");
|
||||
addressSource.put("city", "NewYork");
|
||||
|
||||
Map<String, Object> source = new HashMap<String, Object>();
|
||||
Map<String, Object> source = new HashMap<>();
|
||||
source.put("firstname", "Dave");
|
||||
source.put("lastname", "Matthews");
|
||||
source.put("address", addressSource);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class SpelEvaluatingMethodInterceptorUnitTests {
|
||||
@Test // DATACMNS-630
|
||||
public void allowsMapAccessViaPropertyExpression() throws Throwable {
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("name", "Dave");
|
||||
|
||||
when(invocation.getMethod()).thenReturn(Projection.class.getMethod("propertyFromTarget"));
|
||||
|
||||
Reference in New Issue
Block a user