Fix 'is already an instance of type' warnings

This commit is contained in:
Phillip Webb
2013-01-25 11:27:51 -08:00
parent 36b5ba1871
commit 88f5dd6ce1
9 changed files with 77 additions and 48 deletions

View File

@@ -33,6 +33,7 @@ import org.springframework.core.convert.converter.GenericConverter;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.*;
/**
@@ -136,8 +137,8 @@ public class ConversionServiceFactoryBeanTests {
public ComplexConstructorArgument(Map<String, Class<?>> map) {
assertTrue(!map.isEmpty());
assertTrue(map.keySet().iterator().next() instanceof String);
assertTrue(map.values().iterator().next() instanceof Class);
assertThat(map.keySet().iterator().next(), instanceOf(String.class));
assertThat(map.values().iterator().next(), instanceOf(Class.class));
}
}

View File

@@ -16,6 +16,9 @@
package org.springframework.scheduling.timer;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
@@ -84,7 +87,7 @@ public class TimerSupportTests extends TestCase {
try {
timerFactoryBean.setScheduledTimerTasks(tasks);
timerFactoryBean.afterPropertiesSet();
assertTrue(timerFactoryBean.getObject() instanceof Timer);
assertThat(timerFactoryBean.getObject(), instanceOf(Timer.class));
timerTask0.run();
timerTask1.run();
timerTask2.run();