DATAKV-137 - Polishing.

Remove whitespaces & unused imports, fix warnings.

Original Pull Request: #20
This commit is contained in:
Christoph Strobl
2016-06-14 08:02:19 +02:00
parent 302dfd407c
commit 0ad24ece59
4 changed files with 14 additions and 22 deletions

View File

@@ -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,

View File

@@ -203,7 +203,7 @@ public abstract class AbstractRepositoryUnitTests<T extends AbstractRepositoryUn
protected KeyValueRepositoryFactory createKeyValueRepositoryFactory(KeyValueOperations operations) {
return new KeyValueRepositoryFactory(operations);
}
protected abstract T getRepository(KeyValueRepositoryFactory factory);
public static interface PersonRepository extends CrudRepository<Person, String>, KeyValueRepository<Person, String> {

View File

@@ -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<PersonRepository> {
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);
}
}