diff --git a/src/test/java/org/springframework/data/gemfire/repository/query/GemfireQueryMethodUnitTests.java b/src/test/java/org/springframework/data/gemfire/repository/query/GemfireQueryMethodUnitTests.java index 9f5a3b26..671c7ca8 100644 --- a/src/test/java/org/springframework/data/gemfire/repository/query/GemfireQueryMethodUnitTests.java +++ b/src/test/java/org/springframework/data/gemfire/repository/query/GemfireQueryMethodUnitTests.java @@ -26,6 +26,7 @@ import static org.mockito.Mockito.when; import java.lang.reflect.Method; import org.hamcrest.Matchers; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -104,7 +105,7 @@ public class GemfireQueryMethodUnitTests { assertThat(queryMethod.getLimit(), is(equalTo(expectedLimit))); } else { - assertThat(queryMethod.getLimit(), is(nullValue())); + assertThat(queryMethod.getLimit(), is(equalTo(Integer.MAX_VALUE))); } } @@ -112,12 +113,15 @@ public class GemfireQueryMethodUnitTests { assertLimitedQuery(queryMethod, null); } + @Before + public void setup() { + when(metadata.getDomainType()).thenReturn((Class) Person.class); + when(metadata.getReturnedDomainClass(Mockito.any(Method.class))).thenReturn((Class) Person.class); + } + @Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void detectsAnnotatedQueryCorrectly() throws Exception { - when(metadata.getDomainType()).thenReturn((Class) Person.class); - when(metadata.getReturnedDomainClass(Mockito.any(Method.class))).thenReturn((Class) Person.class); - GemfireQueryMethod method = new GemfireQueryMethod(Sample.class.getMethod("annotated"), metadata, context); assertThat(method.hasAnnotatedQuery(), is(true)); @@ -260,7 +264,7 @@ public class GemfireQueryMethodUnitTests { interface AnnotatedQueryMethods { @Trace - @Hint({ "IdIdx", "LastNameId" }) + @Hint({ "IdIdx", "LastNameIdx" }) void queryWithHint(); @Import("org.example.app.domain.ExampleType") diff --git a/src/test/java/org/springframework/data/gemfire/repository/sample/IncompatibleRegionKeyEntityIdAnimalRepositoryTest.java b/src/test/java/org/springframework/data/gemfire/repository/sample/IncompatibleRegionKeyEntityIdAnimalRepositoryTest.java index 7d99849f..dc02e99f 100644 --- a/src/test/java/org/springframework/data/gemfire/repository/sample/IncompatibleRegionKeyEntityIdAnimalRepositoryTest.java +++ b/src/test/java/org/springframework/data/gemfire/repository/sample/IncompatibleRegionKeyEntityIdAnimalRepositoryTest.java @@ -62,7 +62,7 @@ public class IncompatibleRegionKeyEntityIdAnimalRepositoryTest { catch (BeanCreationException expected) { //expected.printStackTrace(System.err); assertTrue(expected.getCause() instanceof IllegalArgumentException); - assertEquals(String.format("The region referenced only supports keys of type %1$s but the entity to be stored has an id of type %2$s!", + assertEquals(String.format("The Region referenced only supports keys of type %1$s but the entity to be stored has an id of type %2$s!", String.class, Long.class), expected.getCause().getMessage()); throw (IllegalArgumentException) expected.getCause(); } diff --git a/src/test/java/org/springframework/data/gemfire/repository/sample/PlantRepositoryTest.java b/src/test/java/org/springframework/data/gemfire/repository/sample/PlantRepositoryTest.java index 6fd5cf47..2ae52e66 100644 --- a/src/test/java/org/springframework/data/gemfire/repository/sample/PlantRepositoryTest.java +++ b/src/test/java/org/springframework/data/gemfire/repository/sample/PlantRepositoryTest.java @@ -54,7 +54,7 @@ public class PlantRepositoryTest { catch (BeanCreationException expected) { //expected.printStackTrace(System.err); assertTrue(expected.getCause() instanceof IllegalArgumentException); - assertEquals(String.format("The region referenced only supports keys of type %1$s but the entity to be stored has an id of type %2$s!", + assertEquals(String.format("The Region referenced only supports keys of type %1$s but the entity to be stored has an id of type %2$s!", Long.class, String.class), expected.getCause().getMessage()); throw (IllegalArgumentException) expected.getCause(); } diff --git a/src/test/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryUnitTests.java b/src/test/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryUnitTests.java index dcc4047b..604accb1 100644 --- a/src/test/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryUnitTests.java +++ b/src/test/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryUnitTests.java @@ -84,7 +84,7 @@ public class GemfireRepositoryFactoryUnitTests { } catch (IllegalStateException expected) { assertThat(expected.getMessage(), Matchers.startsWith( - "Pagination is not supported by Gemfire repositories!")); + "Pagination is not supported by GemFire Repositories!")); throw expected; } }