diff --git a/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java b/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java index 1808072..c2704d4 100644 --- a/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java +++ b/src/main/java/org/springframework/data/keyvalue/repository/query/KeyValuePartTreeQuery.java @@ -144,7 +144,7 @@ public class KeyValuePartTreeQuery implements RepositoryQuery { parameters); criteria = new SpelCriteria(spelExpression, context); } - + KeyValueQuery query = new KeyValueQuery(criteria); Pageable pageable = accessor.getPageable(); Sort sort = accessor.getSort(); @@ -157,12 +157,12 @@ public class KeyValuePartTreeQuery implements RepositoryQuery { } private SpelExpression getSpelExpression(Object criteria) { - - if(criteria instanceof SpelExpression){ + + if (criteria instanceof SpelExpression) { return (SpelExpression) criteria; } - - if(criteria instanceof SpelCriteria){ + + if (criteria instanceof SpelCriteria) { return getSpelExpression(((SpelCriteria) criteria).getExpression()); } diff --git a/src/test/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQueryUnitTests.java b/src/test/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQueryUnitTests.java index 67014a6..23788c5 100644 --- a/src/test/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQueryUnitTests.java +++ b/src/test/java/org/springframework/data/keyvalue/repository/query/CachingKeyValuePartTreeQueryUnitTests.java @@ -18,7 +18,7 @@ package org.springframework.data.keyvalue.repository.query; import static org.hamcrest.core.IsNot.*; import static org.hamcrest.core.IsSame.*; import static org.junit.Assert.*; -import static org.mockito.Matchers.any; +import static org.mockito.Matchers.*; import static org.mockito.Mockito.*; import java.lang.reflect.Method; @@ -39,7 +39,7 @@ import org.springframework.data.repository.query.QueryMethod; /** * Unit tests for {@link CachingKeyValuePartTreeQuery}. - * + * * @author Mark Paluch */ @RunWith(MockitoJUnitRunner.class) @@ -50,6 +50,7 @@ public class CachingKeyValuePartTreeQueryUnitTests { @Mock ProjectionFactory projectionFactoryMock; @Before + @SuppressWarnings({ "unchecked", "rawtypes" }) public void setUp() throws Exception { when(metadataMock.getDomainType()).thenReturn((Class) Person.class); @@ -60,7 +61,6 @@ public class CachingKeyValuePartTreeQueryUnitTests { * @see DATAKV-137 */ @Test - @SuppressWarnings({ "unchecked", "rawtypes" }) public void cachedSpelExpressionShouldBeReusedWithNewContext() throws NoSuchMethodException, SecurityException { QueryMethod qm = new QueryMethod(Repo.class.getMethod("findByFirstname", String.class), metadataMock, diff --git a/src/test/java/org/springframework/data/map/AbstractRepositoryUnitTests.java b/src/test/java/org/springframework/data/map/AbstractRepositoryUnitTests.java index 023814d..1d342e2 100644 --- a/src/test/java/org/springframework/data/map/AbstractRepositoryUnitTests.java +++ b/src/test/java/org/springframework/data/map/AbstractRepositoryUnitTests.java @@ -203,7 +203,7 @@ public abstract class AbstractRepositoryUnitTests, KeyValueRepository { diff --git a/src/test/java/org/springframework/data/map/CachingQuerySimpleKeyValueRepositoryUnitTests.java b/src/test/java/org/springframework/data/map/CachingQuerySimpleKeyValueRepositoryUnitTests.java index 6fec61a..d294192 100644 --- a/src/test/java/org/springframework/data/map/CachingQuerySimpleKeyValueRepositoryUnitTests.java +++ b/src/test/java/org/springframework/data/map/CachingQuerySimpleKeyValueRepositoryUnitTests.java @@ -15,31 +15,23 @@ */ package org.springframework.data.map; -import static org.hamcrest.Matchers.hasItems; -import static org.junit.Assert.assertThat; - -import org.junit.Test; import org.springframework.data.keyvalue.core.KeyValueOperations; import org.springframework.data.keyvalue.repository.query.CachingKeyValuePartTreeQuery; import org.springframework.data.keyvalue.repository.query.SpelQueryCreator; import org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory; import org.springframework.data.keyvalue.repository.support.SimpleKeyValueRepository; -import org.springframework.data.map.AbstractRepositoryUnitTests.PersonRepository; /** - * Unit tests for {@link SimpleKeyValueRepository} using {@link CachingKeyValuePartTreeQuery} and {@link SpelQueryCreator}. - * + * Unit tests for {@link SimpleKeyValueRepository} using {@link CachingKeyValuePartTreeQuery} and + * {@link SpelQueryCreator}. + * * @author Mark Paluch + * @author Christoph Strobl */ -public class CachingQuerySimpleKeyValueRepositoryUnitTests extends AbstractRepositoryUnitTests { +public class CachingQuerySimpleKeyValueRepositoryUnitTests extends SimpleKeyValueRepositoryUnitTests { @Override protected KeyValueRepositoryFactory createKeyValueRepositoryFactory(KeyValueOperations operations) { return new KeyValueRepositoryFactory(operations, SpelQueryCreator.class, CachingKeyValuePartTreeQuery.class); } - - @Override - protected PersonRepository getRepository(KeyValueRepositoryFactory factory) { - return factory.getRepository(PersonRepository.class); - } }