Fix boxing and some raw types warninga

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1023862 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-10-18 15:47:27 +00:00
parent 5acf983bd8
commit 3a00afab89
13 changed files with 21 additions and 10 deletions

View File

@ -49,6 +49,7 @@ import org.apache.commons.collections.collection.TestTransformedCollection;
* @author Janek Bogucki * @author Janek Bogucki
* @author Neil O'Toole * @author Neil O'Toole
*/ */
@SuppressWarnings("boxing")
public class TestMapUtils extends BulkTest { public class TestMapUtils extends BulkTest {
public TestMapUtils(String name) { public TestMapUtils(String name) {
@ -744,7 +745,7 @@ public class TestMapUtils extends BulkTest {
public void testPopulateMap() { public void testPopulateMap() {
// Setup Test Data // Setup Test Data
List list = new ArrayList(); List<String> list = new ArrayList<String>();
list.add("1"); list.add("1");
list.add("3"); list.add("3");
list.add("5"); list.add("5");
@ -754,27 +755,27 @@ public class TestMapUtils extends BulkTest {
list.add("6"); list.add("6");
// Now test key transform population // Now test key transform population
Map map = new HashMap(); Map<Object, Object> map = new HashMap<Object, Object>();
MapUtils.populateMap(map, list, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); MapUtils.populateMap(map, list, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(list.size(), map.size()); assertEquals(list.size(), map.size());
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
assertEquals(true, map.containsKey(new Integer((String) list.get(i)))); assertEquals(true, map.containsKey(new Integer(list.get(i))));
assertEquals(false, map.containsKey(list.get(i))); assertEquals(false, map.containsKey(list.get(i)));
assertEquals(true, map.containsValue(list.get(i))); assertEquals(true, map.containsValue(list.get(i)));
assertEquals(list.get(i), map.get(new Integer((String) list.get(i)))); assertEquals(list.get(i), map.get(new Integer(list.get(i))));
} }
// Now test both Key-Value transform population // Now test both Key-Value transform population
map = new HashMap(); map = new HashMap<Object, Object>();
MapUtils.populateMap(map, list, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER); MapUtils.populateMap(map, list, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(list.size(), map.size()); assertEquals(list.size(), map.size());
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
assertEquals(true, map.containsKey(new Integer((String) list.get(i)))); assertEquals(true, map.containsKey(new Integer(list.get(i))));
assertEquals(false, map.containsKey(list.get(i))); assertEquals(false, map.containsKey(list.get(i)));
assertEquals(true, map.containsValue(new Integer((String) list.get(i)))); assertEquals(true, map.containsValue(new Integer(list.get(i))));
assertEquals(new Integer((String) list.get(i)), map.get(new Integer((String) list.get(i)))); assertEquals(new Integer(list.get(i)), map.get(new Integer(list.get(i))));
} }
} }

View File

@ -49,6 +49,7 @@ import org.junit.Test;
* @author Stephen Colebourne * @author Stephen Colebourne
* @author Matt Benson * @author Matt Benson
*/ */
@SuppressWarnings("boxing")
public class TestPredicateUtils extends BasicPredicateTestBase { public class TestPredicateUtils extends BasicPredicateTestBase {
/** /**
* Set up instance variables required by this test case. * Set up instance variables required by this test case.

View File

@ -39,6 +39,7 @@ import org.apache.commons.collections.comparators.ReverseComparator;
* @author Michael A. Smith * @author Michael A. Smith
* @author Steve Phelps * @author Steve Phelps
*/ */
@SuppressWarnings("boxing")
public class TestPriorityBuffer<E> extends AbstractTestCollection<E> { public class TestPriorityBuffer<E> extends AbstractTestCollection<E> {
public TestPriorityBuffer(String testName) { public TestPriorityBuffer(String testName) {

View File

@ -27,6 +27,7 @@ import java.util.List;
* *
* @author Rodney Waldhoff * @author Rodney Waldhoff
*/ */
@SuppressWarnings("boxing")
public class TestBooleanComparator extends AbstractTestComparator<Boolean> { public class TestBooleanComparator extends AbstractTestComparator<Boolean> {
// conventional // conventional

View File

@ -25,8 +25,8 @@ import java.util.List;
* *
* @version $Revision$ $Date$ * @version $Revision$ $Date$
* *
* @author Unknown
*/ */
@SuppressWarnings("boxing")
public class TestComparableComparator extends AbstractTestComparator<Integer> { public class TestComparableComparator extends AbstractTestComparator<Integer> {
public TestComparableComparator(String testName) { public TestComparableComparator(String testName) {

View File

@ -73,6 +73,7 @@ public abstract class AbstractTestAnyAllOnePredicate<T> extends AbstractTestComp
* Tests creating composite predicate instances with single predicates and verifies that the composite returns * Tests creating composite predicate instances with single predicates and verifies that the composite returns
* the same value as the single predicate does. * the same value as the single predicate does.
*/ */
@SuppressWarnings("boxing")
public final void singleValues() { public final void singleValues() {
assertTrue(getPredicateInstance(true).evaluate(null)); assertTrue(getPredicateInstance(true).evaluate(null));
assertFalse(getPredicateInstance(false).evaluate(null)); assertFalse(getPredicateInstance(false).evaluate(null));

View File

@ -91,7 +91,7 @@ public abstract class MockPredicateTestBase<T> {
* *
* @return a single mock predicate. * @return a single mock predicate.
*/ */
@SuppressWarnings({"unchecked"}) @SuppressWarnings({"unchecked", "boxing"})
protected final Predicate<T> createMockPredicate(final Boolean returnValue) { protected final Predicate<T> createMockPredicate(final Boolean returnValue) {
final Predicate<T> mockPredicate = EasyMock.createMock(Predicate.class); final Predicate<T> mockPredicate = EasyMock.createMock(Predicate.class);
if (returnValue != null) { if (returnValue != null) {

View File

@ -18,6 +18,7 @@ import java.util.Collections;
* *
* @author Edwin Tellman * @author Edwin Tellman
*/ */
@SuppressWarnings("boxing")
public class TestAllPredicate extends AbstractTestAnyAllOnePredicate<Integer> { public class TestAllPredicate extends AbstractTestAnyAllOnePredicate<Integer> {
/** /**

View File

@ -45,6 +45,7 @@ public class TestEqualPredicate extends BasicPredicateTestBase {
assertTrue(equalPredicate(TRUE_OBJECT), TRUE_OBJECT); assertTrue(equalPredicate(TRUE_OBJECT), TRUE_OBJECT);
} }
@SuppressWarnings("boxing")
@Test @Test
public void testPredicateTypeCanBeSuperClassOfObject() throws Exception { public void testPredicateTypeCanBeSuperClassOfObject() throws Exception {
Predicate<Number> predicate = equalPredicate((Number) 4); Predicate<Number> predicate = equalPredicate((Number) 4);

View File

@ -27,6 +27,7 @@ import org.apache.commons.collections.comparators.ComparableComparator;
* @version $Revision$ $Date$ * @version $Revision$ $Date$
* @author Rodney Waldhoff * @author Rodney Waldhoff
*/ */
@SuppressWarnings("boxing")
public class TestCollatingIterator extends AbstractTestIterator<Integer> { public class TestCollatingIterator extends AbstractTestIterator<Integer> {
//------------------------------------------------------------ Conventional //------------------------------------------------------------ Conventional

View File

@ -31,6 +31,7 @@ import org.apache.commons.collections.Predicate;
* *
* @author Rodney Waldhoff * @author Rodney Waldhoff
*/ */
@SuppressWarnings("boxing")
public class TestFilterListIterator extends TestCase { public class TestFilterListIterator extends TestCase {
public TestFilterListIterator(String testName) { public TestFilterListIterator(String testName) {
super(testName); super(testName);

View File

@ -35,6 +35,7 @@ import org.junit.Test;
* *
* @author Phil Steitz * @author Phil Steitz
*/ */
@SuppressWarnings("boxing")
public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> { public class TestLazyMap<K, V> extends AbstractTestIterableMap<K, V> {
private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1); private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);

View File

@ -38,6 +38,7 @@ import org.junit.Test;
* *
* @author Phil Steitz * @author Phil Steitz
*/ */
@SuppressWarnings("boxing")
public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> { public class TestLazySortedMap<K, V> extends AbstractTestSortedMap<K, V> {
private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1); private static final Factory<Integer> oneFactory = FactoryUtils.constantFactory(1);