SGF-564 - Resolve Java compiler ambiguities.

This commit is contained in:
Mark Paluch
2016-11-10 12:24:54 +01:00
parent 32c66ddba3
commit 7dbb31c988
8 changed files with 24 additions and 24 deletions

View File

@@ -206,7 +206,7 @@ public class GemfireTemplateIntegrationTests {
public void get() {
String key = getKey(getUser("imaPigg"));
assertThat(usersTemplate.get(key)).isEqualTo(users.get(key));
assertThat((Object) usersTemplate.get(key)).isEqualTo(users.get(key));
assertNullEquals(users.get("mrT"), usersTemplate.get("mrT"));
}
@@ -234,11 +234,11 @@ public class GemfireTemplateIntegrationTests {
User mandyHandy = users.get(getKey(getUser("mandyHandy")));
assertThat(mandyHandy).isNotNull();
assertThat(usersTemplate.remove(getKey(mandyHandy))).isEqualTo(mandyHandy);
assertThat((User) usersTemplate.remove(getKey(mandyHandy))).isEqualTo(mandyHandy);
assertThat(users.containsKey(getKey(mandyHandy))).isFalse();
assertThat(users.containsValue(mandyHandy)).isFalse();
assertThat(users.containsKey("loisGriffon")).isFalse();
assertThat(usersTemplate.remove("loisGriffon")).isNull();
assertThat((User) usersTemplate.remove("loisGriffon")).isNull();
assertThat(users.containsKey("loisGriffon")).isFalse();
}

View File

@@ -212,7 +212,7 @@ public class GemfireTemplateUnitTests extends AbstractUnitAndIntegrationTestsWit
when(mockQuery.execute(eq(expectedParams))).thenReturn(mockSelectResults);
when(mockSelectResults.asList()).thenReturn(Collections.singletonList(1));
assertThat(template.findUnique(expectedQuery, expectedParams)).isEqualTo(1);
assertThat(template.<Integer>findUnique(expectedQuery, expectedParams)).isEqualTo(1);
verify(mockRegion, atLeastOnce()).getRegionService();
verify(mockRegionService, times(1)).getQueryService();
@@ -228,7 +228,7 @@ public class GemfireTemplateUnitTests extends AbstractUnitAndIntegrationTestsWit
when(mockQuery.execute(eq(expectedParams))).thenReturn("test");
assertThat(template.findUnique(expectedQuery, expectedParams)).isEqualTo("test");
assertThat(template.<String>findUnique(expectedQuery, expectedParams)).isEqualTo("test");
verify(mockRegion, atLeastOnce()).getRegionService();
verify(mockRegionService, times(1)).getQueryService();
@@ -247,7 +247,7 @@ public class GemfireTemplateUnitTests extends AbstractUnitAndIntegrationTestsWit
when(mockSelectResults.asList()).thenReturn(Arrays.asList(1, 2));
try {
assertThat(template.findUnique(expectedQuery, expectedParams)).isEqualTo(1);
assertThat(template.<Integer>findUnique(expectedQuery, expectedParams)).isEqualTo(1);
}
finally {
verify(mockRegion, atLeastOnce()).getRegionService();

View File

@@ -202,8 +202,8 @@ public class AbstractCacheConfigurationUnitTests {
MappingPdxSerializer pdxSerializer = cacheConfiguration.newPdxSerializer();
assertThat(pdxSerializer).isNotNull();
assertThat(invokeMethod(pdxSerializer, "getConversionService")).isEqualTo(mockConversionService);
assertThat(invokeMethod(pdxSerializer, "getMappingContext")).isEqualTo(mockMappingContext);
assertThat((Object) invokeMethod(pdxSerializer, "getConversionService")).isEqualTo(mockConversionService);
assertThat((Object) invokeMethod(pdxSerializer, "getMappingContext")).isEqualTo(mockMappingContext);
verify(mockBeanFactory, times(1)).getConversionService();
verifyZeroInteractions(mockConversionService);
@@ -217,8 +217,8 @@ public class AbstractCacheConfigurationUnitTests {
MappingPdxSerializer pdxSerializer = cacheConfiguration.newPdxSerializer();
assertThat(pdxSerializer).isNotNull();
assertThat(invokeMethod(pdxSerializer, "getConversionService")).isInstanceOf(ConversionService.class);
assertThat(invokeMethod(pdxSerializer, "getMappingContext")).isInstanceOf(GemfireMappingContext.class);
assertThat((Object) invokeMethod(pdxSerializer, "getConversionService")).isInstanceOf(ConversionService.class);
assertThat((Object) invokeMethod(pdxSerializer, "getMappingContext")).isInstanceOf(GemfireMappingContext.class);
}
protected static class TestCacheConfiguration extends AbstractCacheConfiguration {

View File

@@ -113,11 +113,11 @@ public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest {
assertNotNull(gatewaySenderFactoryBean);
assertNotNull(TestUtils.readField("cache", gatewaySenderFactoryBean));
assertEquals(2, TestUtils.readField("remoteDistributedSystemId", gatewaySenderFactoryBean));
assertEquals(10, TestUtils.readField("alertThreshold", gatewaySenderFactoryBean));
assertEquals(2, TestUtils.<Integer>readField("remoteDistributedSystemId", gatewaySenderFactoryBean).longValue());
assertEquals(10, TestUtils.<Integer>readField("alertThreshold", gatewaySenderFactoryBean).longValue());
assertTrue(Boolean.TRUE.equals(TestUtils.readField("batchConflationEnabled", gatewaySenderFactoryBean)));
assertEquals(11, TestUtils.readField("batchSize", gatewaySenderFactoryBean));
assertEquals(12, TestUtils.readField("dispatcherThreads", gatewaySenderFactoryBean));
assertEquals(11, TestUtils.<Integer>readField("batchSize", gatewaySenderFactoryBean).intValue());
assertEquals(12, TestUtils.<Integer>readField("dispatcherThreads", gatewaySenderFactoryBean).intValue());
assertEquals(false, TestUtils.readField("diskSynchronous", gatewaySenderFactoryBean));
assertEquals(true, TestUtils.readField("manualStart", gatewaySenderFactoryBean));
@@ -189,10 +189,10 @@ public class GemfireV7GatewayNamespaceTest extends RecreatingContextTest {
assertNotNull(gatewaySenderFactoryBean);
assertNotNull(TestUtils.readField("cache", gatewaySenderFactoryBean));
assertEquals(3, TestUtils.readField("remoteDistributedSystemId", gatewaySenderFactoryBean));
assertEquals(3, TestUtils.<Integer>readField("remoteDistributedSystemId", gatewaySenderFactoryBean).intValue());
assertTrue(Boolean.TRUE.equals(TestUtils.readField("batchConflationEnabled", gatewaySenderFactoryBean)));
assertEquals(50, TestUtils.readField("batchSize", gatewaySenderFactoryBean));
assertEquals(10, TestUtils.readField("dispatcherThreads", gatewaySenderFactoryBean));
assertEquals(50, TestUtils.<Integer>readField("batchSize", gatewaySenderFactoryBean).intValue());
assertEquals(10, TestUtils.<Integer>readField("dispatcherThreads", gatewaySenderFactoryBean).intValue());
assertEquals(true, TestUtils.readField("manualStart", gatewaySenderFactoryBean));
List<GatewayEventFilter> eventFilters = TestUtils.readField("eventFilters", gatewaySenderFactoryBean);

View File

@@ -65,8 +65,8 @@ public class InvalidRegionExpirationAttributesNamespaceTest {
initializeApplicationContext(configureContext(createApplicationContext()));
}
catch (XmlBeanDefinitionStoreException expected) {
expected.printStackTrace();
assertTrue(expected.getCause() instanceof SAXParseException);
assertTrue(expected.getMessage().contains("Invalid content was found starting with element 'bean'"));
throw expected;
}
}

View File

@@ -123,7 +123,7 @@ public class AbstractFunctionExecutionTest {
}
};
assertThat(String.valueOf(functionExecution.executeAndExtract()), is(equalTo("test")));
assertThat(functionExecution.executeAndExtract(), is(equalTo("test")));
}
@Test
@@ -141,7 +141,7 @@ public class AbstractFunctionExecutionTest {
}
};
assertThat(String.valueOf(functionExecution.executeAndExtract()), is(equalTo("one")));
assertThat(functionExecution.executeAndExtract(), is(equalTo("one")));
}
@Test

View File

@@ -144,9 +144,9 @@ public class SimpleGemfireRepositoryIntegrationTests {
repository.save(Arrays.asList(johnBlum, jonBloom, juanBlume));
assertThat(template.getRegion().size()).isEqualTo(3);
assertThat(template.get(johnBlum.getId())).isEqualTo(johnBlum);
assertThat(template.get(jonBloom.getId())).isEqualTo(jonBloom);
assertThat(template.get(juanBlume.getId())).isEqualTo(juanBlume);
assertThat((Person) template.get(johnBlum.getId())).isEqualTo(johnBlum);
assertThat((Person) template.get(jonBloom.getId())).isEqualTo(jonBloom);
assertThat((Person) template.get(juanBlume.getId())).isEqualTo(juanBlume);
}
@SuppressWarnings("rawtypes")

View File

@@ -66,7 +66,7 @@ public class ArrayUtilsUnitTests {
@Test
public void getFirstWithNullOrEmptyArrayAndNoDefaultReturnsNull() {
assertThat(ArrayUtils.getFirst((Object[]) null)).isNull();
assertThat(ArrayUtils.getFirst()).isNull();
assertThat(ArrayUtils.<Object>getFirst()).isNull();
}
@Test