From 05afd18933fdce69c011d34cab337afd05771228 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Sun, 28 Apr 2013 23:09:52 +0000 Subject: [PATCH] Simplify and avoid complaints about "dead store to actual" git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1476853 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/collections4/BagUtilsTest.java | 24 +++++++++---------- .../collections4/CollectionUtilsTest.java | 10 ++++---- .../commons/collections4/ListUtilsTest.java | 4 ++-- .../commons/collections4/MapUtilsTest.java | 2 +- .../commons/collections4/SetUtilsTest.java | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/test/java/org/apache/commons/collections4/BagUtilsTest.java b/src/test/java/org/apache/commons/collections4/BagUtilsTest.java index 6728ce481..4e0b10bcb 100644 --- a/src/test/java/org/apache/commons/collections4/BagUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/BagUtilsTest.java @@ -64,7 +64,7 @@ public class BagUtilsTest extends BulkTest { assertTrue("Returned object should be a SynchronizedBag.", bag instanceof SynchronizedBag); try { - bag = BagUtils.synchronizedBag(null); + BagUtils.synchronizedBag(null); fail("Expecting IllegalArgumentException for null bag."); } catch (final IllegalArgumentException ex) { // expected @@ -76,7 +76,7 @@ public class BagUtilsTest extends BulkTest { assertTrue("Returned object should be an UnmodifiableBag.", bag instanceof UnmodifiableBag); try { - bag = BagUtils.unmodifiableBag(null); + BagUtils.unmodifiableBag(null); fail("Expecting IllegalArgumentException for null bag."); } catch (final IllegalArgumentException ex) { // expected @@ -88,13 +88,13 @@ public class BagUtilsTest extends BulkTest { assertTrue("Returned object should be a PredicatedBag.", bag instanceof PredicatedBag); try { - bag = BagUtils.predicatedBag(null,truePredicate); + BagUtils.predicatedBag(null,truePredicate); fail("Expecting IllegalArgumentException for null bag."); } catch (final IllegalArgumentException ex) { // expected } try { - bag = BagUtils.predicatedBag(new HashBag(), null); + BagUtils.predicatedBag(new HashBag(), null); fail("Expecting IllegalArgumentException for null predicate."); } catch (final IllegalArgumentException ex) { // expected @@ -106,13 +106,13 @@ public class BagUtilsTest extends BulkTest { assertTrue("Returned object should be an TransformedBag.", bag instanceof TransformedBag); try { - bag = BagUtils.transformingBag(null, nopTransformer); + BagUtils.transformingBag(null, nopTransformer); fail("Expecting IllegalArgumentException for null bag."); } catch (final IllegalArgumentException ex) { // expected } try { - bag = BagUtils.transformingBag(new HashBag(), null); + BagUtils.transformingBag(new HashBag(), null); fail("Expecting IllegalArgumentException for null transformer."); } catch (final IllegalArgumentException ex) { // expected @@ -124,7 +124,7 @@ public class BagUtilsTest extends BulkTest { assertTrue("Returned object should be a SynchronizedSortedBag.", bag instanceof SynchronizedSortedBag); try { - bag = BagUtils.synchronizedSortedBag(null); + BagUtils.synchronizedSortedBag(null); fail("Expecting IllegalArgumentException for null bag."); } catch (final IllegalArgumentException ex) { // expected @@ -136,7 +136,7 @@ public class BagUtilsTest extends BulkTest { assertTrue("Returned object should be an UnmodifiableSortedBag.", bag instanceof UnmodifiableSortedBag); try { - bag = BagUtils.unmodifiableSortedBag(null); + BagUtils.unmodifiableSortedBag(null); fail("Expecting IllegalArgumentException for null bag."); } catch (final IllegalArgumentException ex) { // expected @@ -148,13 +148,13 @@ public class BagUtilsTest extends BulkTest { assertTrue("Returned object should be a PredicatedSortedBag.", bag instanceof PredicatedSortedBag); try { - bag = BagUtils.predicatedSortedBag(null, truePredicate); + BagUtils.predicatedSortedBag(null, truePredicate); fail("Expecting IllegalArgumentException for null bag."); } catch (final IllegalArgumentException ex) { // expected } try { - bag = BagUtils.predicatedSortedBag(new TreeBag(), null); + BagUtils.predicatedSortedBag(new TreeBag(), null); fail("Expecting IllegalArgumentException for null predicate."); } catch (final IllegalArgumentException ex) { // expected @@ -166,13 +166,13 @@ public class BagUtilsTest extends BulkTest { assertTrue("Returned object should be an TransformedSortedBag", bag instanceof TransformedSortedBag); try { - bag = BagUtils.transformingSortedBag(null, nopTransformer); + BagUtils.transformingSortedBag(null, nopTransformer); fail("Expecting IllegalArgumentException for null bag."); } catch (final IllegalArgumentException ex) { // expected } try { - bag = BagUtils.transformingSortedBag(new TreeBag(), null); + BagUtils.transformingSortedBag(new TreeBag(), null); fail("Expecting IllegalArgumentException for null transformer."); } catch (final IllegalArgumentException ex) { // expected diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java index 7c01bbf4f..863121300 100644 --- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java @@ -1279,7 +1279,7 @@ public class CollectionUtilsTest extends MockTestCase { Collection collection = CollectionUtils.predicatedCollection(new ArrayList(), predicate); assertTrue("returned object should be a PredicatedCollection", collection instanceof PredicatedCollection); try { - collection = CollectionUtils.predicatedCollection(new ArrayList(), null); + CollectionUtils.predicatedCollection(new ArrayList(), null); fail("Expecting IllegalArgumentException for null predicate."); } catch (final IllegalArgumentException ex) { // expected @@ -1454,13 +1454,13 @@ public class CollectionUtilsTest extends MockTestCase { Collection collection = CollectionUtils.transformingCollection(new ArrayList(), transformer); assertTrue("returned object should be a TransformedCollection", collection instanceof TransformedCollection); try { - collection = CollectionUtils.transformingCollection(new ArrayList(), null); + CollectionUtils.transformingCollection(new ArrayList(), null); fail("Expecting IllegalArgumentException for null transformer."); } catch (final IllegalArgumentException ex) { // expected } try { - collection = CollectionUtils.transformingCollection(null, transformer); + CollectionUtils.transformingCollection(null, transformer); fail("Expecting IllegalArgumentException for null collection."); } catch (final IllegalArgumentException ex) { // expected @@ -1484,7 +1484,7 @@ public class CollectionUtilsTest extends MockTestCase { Collection col = CollectionUtils.synchronizedCollection(new ArrayList()); assertTrue("Returned object should be a SynchronizedCollection.", col instanceof SynchronizedCollection); try { - col = CollectionUtils.synchronizedCollection(null); + CollectionUtils.synchronizedCollection(null); fail("Expecting IllegalArgumentException for null collection."); } catch (final IllegalArgumentException ex) { // expected @@ -1496,7 +1496,7 @@ public class CollectionUtilsTest extends MockTestCase { Collection col = CollectionUtils.unmodifiableCollection(new ArrayList()); assertTrue("Returned object should be a UnmodifiableCollection.", col instanceof UnmodifiableCollection); try { - col = CollectionUtils.unmodifiableCollection(null); + CollectionUtils.unmodifiableCollection(null); fail("Expecting IllegalArgumentException for null collection."); } catch (final IllegalArgumentException ex) { // expected diff --git a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java index 08e8a8559..de724d7ca 100644 --- a/src/test/java/org/apache/commons/collections4/ListUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/ListUtilsTest.java @@ -137,13 +137,13 @@ public class ListUtilsTest extends BulkTest { List list = ListUtils.predicatedList(new ArrayList(), predicate); assertTrue("returned object should be a PredicatedList", list instanceof PredicatedList); try { - list = ListUtils.predicatedList(new ArrayList(), null); + ListUtils.predicatedList(new ArrayList(), null); fail("Expecting IllegalArgumentException for null predicate."); } catch (final IllegalArgumentException ex) { // expected } try { - list = ListUtils.predicatedList(null, predicate); + ListUtils.predicatedList(null, predicate); fail("Expecting IllegalArgumentException for null list."); } catch (final IllegalArgumentException ex) { // expected diff --git a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java index 191bf49d6..9aa3b34d3 100644 --- a/src/test/java/org/apache/commons/collections4/MapUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/MapUtilsTest.java @@ -77,7 +77,7 @@ public class MapUtilsTest extends BulkTest { Map map = MapUtils.predicatedMap(new HashMap(), p, p); assertTrue("returned object should be a PredicatedMap", map instanceof PredicatedMap); try { - map = MapUtils.predicatedMap(null, p, p); + MapUtils.predicatedMap(null, p, p); fail("Expecting IllegalArgumentException for null map."); } catch (final IllegalArgumentException e) { // expected diff --git a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java index eee543eae..e47b14252 100644 --- a/src/test/java/org/apache/commons/collections4/SetUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/SetUtilsTest.java @@ -54,13 +54,13 @@ public class SetUtilsTest extends BulkTest { Set set = SetUtils.predicatedSet(new HashSet(), predicate); assertTrue("returned object should be a PredicatedSet", set instanceof PredicatedSet); try { - set = SetUtils.predicatedSet(new HashSet(), null); + SetUtils.predicatedSet(new HashSet(), null); fail("Expecting IllegalArgumentException for null predicate."); } catch (final IllegalArgumentException ex) { // expected } try { - set = SetUtils.predicatedSet(null, predicate); + SetUtils.predicatedSet(null, predicate); fail("Expecting IllegalArgumentException for null set."); } catch (final IllegalArgumentException ex) { // expected