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
This commit is contained in:
Sebastian Bazley 2013-04-28 23:09:52 +00:00
parent 90634a969a
commit 05afd18933
5 changed files with 22 additions and 22 deletions

View File

@ -64,7 +64,7 @@ public class BagUtilsTest extends BulkTest {
assertTrue("Returned object should be a SynchronizedBag.", assertTrue("Returned object should be a SynchronizedBag.",
bag instanceof SynchronizedBag); bag instanceof SynchronizedBag);
try { try {
bag = BagUtils.synchronizedBag(null); BagUtils.synchronizedBag(null);
fail("Expecting IllegalArgumentException for null bag."); fail("Expecting IllegalArgumentException for null bag.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -76,7 +76,7 @@ public class BagUtilsTest extends BulkTest {
assertTrue("Returned object should be an UnmodifiableBag.", assertTrue("Returned object should be an UnmodifiableBag.",
bag instanceof UnmodifiableBag); bag instanceof UnmodifiableBag);
try { try {
bag = BagUtils.unmodifiableBag(null); BagUtils.unmodifiableBag(null);
fail("Expecting IllegalArgumentException for null bag."); fail("Expecting IllegalArgumentException for null bag.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -88,13 +88,13 @@ public class BagUtilsTest extends BulkTest {
assertTrue("Returned object should be a PredicatedBag.", assertTrue("Returned object should be a PredicatedBag.",
bag instanceof PredicatedBag); bag instanceof PredicatedBag);
try { try {
bag = BagUtils.predicatedBag(null,truePredicate); BagUtils.predicatedBag(null,truePredicate);
fail("Expecting IllegalArgumentException for null bag."); fail("Expecting IllegalArgumentException for null bag.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
} }
try { try {
bag = BagUtils.predicatedBag(new HashBag<Object>(), null); BagUtils.predicatedBag(new HashBag<Object>(), null);
fail("Expecting IllegalArgumentException for null predicate."); fail("Expecting IllegalArgumentException for null predicate.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -106,13 +106,13 @@ public class BagUtilsTest extends BulkTest {
assertTrue("Returned object should be an TransformedBag.", assertTrue("Returned object should be an TransformedBag.",
bag instanceof TransformedBag); bag instanceof TransformedBag);
try { try {
bag = BagUtils.transformingBag(null, nopTransformer); BagUtils.transformingBag(null, nopTransformer);
fail("Expecting IllegalArgumentException for null bag."); fail("Expecting IllegalArgumentException for null bag.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
} }
try { try {
bag = BagUtils.transformingBag(new HashBag<Object>(), null); BagUtils.transformingBag(new HashBag<Object>(), null);
fail("Expecting IllegalArgumentException for null transformer."); fail("Expecting IllegalArgumentException for null transformer.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -124,7 +124,7 @@ public class BagUtilsTest extends BulkTest {
assertTrue("Returned object should be a SynchronizedSortedBag.", assertTrue("Returned object should be a SynchronizedSortedBag.",
bag instanceof SynchronizedSortedBag); bag instanceof SynchronizedSortedBag);
try { try {
bag = BagUtils.synchronizedSortedBag(null); BagUtils.synchronizedSortedBag(null);
fail("Expecting IllegalArgumentException for null bag."); fail("Expecting IllegalArgumentException for null bag.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -136,7 +136,7 @@ public class BagUtilsTest extends BulkTest {
assertTrue("Returned object should be an UnmodifiableSortedBag.", assertTrue("Returned object should be an UnmodifiableSortedBag.",
bag instanceof UnmodifiableSortedBag); bag instanceof UnmodifiableSortedBag);
try { try {
bag = BagUtils.unmodifiableSortedBag(null); BagUtils.unmodifiableSortedBag(null);
fail("Expecting IllegalArgumentException for null bag."); fail("Expecting IllegalArgumentException for null bag.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -148,13 +148,13 @@ public class BagUtilsTest extends BulkTest {
assertTrue("Returned object should be a PredicatedSortedBag.", assertTrue("Returned object should be a PredicatedSortedBag.",
bag instanceof PredicatedSortedBag); bag instanceof PredicatedSortedBag);
try { try {
bag = BagUtils.predicatedSortedBag(null, truePredicate); BagUtils.predicatedSortedBag(null, truePredicate);
fail("Expecting IllegalArgumentException for null bag."); fail("Expecting IllegalArgumentException for null bag.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
} }
try { try {
bag = BagUtils.predicatedSortedBag(new TreeBag<Object>(), null); BagUtils.predicatedSortedBag(new TreeBag<Object>(), null);
fail("Expecting IllegalArgumentException for null predicate."); fail("Expecting IllegalArgumentException for null predicate.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -166,13 +166,13 @@ public class BagUtilsTest extends BulkTest {
assertTrue("Returned object should be an TransformedSortedBag", assertTrue("Returned object should be an TransformedSortedBag",
bag instanceof TransformedSortedBag); bag instanceof TransformedSortedBag);
try { try {
bag = BagUtils.transformingSortedBag(null, nopTransformer); BagUtils.transformingSortedBag(null, nopTransformer);
fail("Expecting IllegalArgumentException for null bag."); fail("Expecting IllegalArgumentException for null bag.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
} }
try { try {
bag = BagUtils.transformingSortedBag(new TreeBag<Object>(), null); BagUtils.transformingSortedBag(new TreeBag<Object>(), null);
fail("Expecting IllegalArgumentException for null transformer."); fail("Expecting IllegalArgumentException for null transformer.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected

View File

@ -1279,7 +1279,7 @@ public class CollectionUtilsTest extends MockTestCase {
Collection<Number> collection = CollectionUtils.predicatedCollection(new ArrayList<Number>(), predicate); Collection<Number> collection = CollectionUtils.predicatedCollection(new ArrayList<Number>(), predicate);
assertTrue("returned object should be a PredicatedCollection", collection instanceof PredicatedCollection); assertTrue("returned object should be a PredicatedCollection", collection instanceof PredicatedCollection);
try { try {
collection = CollectionUtils.predicatedCollection(new ArrayList<Number>(), null); CollectionUtils.predicatedCollection(new ArrayList<Number>(), null);
fail("Expecting IllegalArgumentException for null predicate."); fail("Expecting IllegalArgumentException for null predicate.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -1454,13 +1454,13 @@ public class CollectionUtilsTest extends MockTestCase {
Collection<Object> collection = CollectionUtils.transformingCollection(new ArrayList<Object>(), transformer); Collection<Object> collection = CollectionUtils.transformingCollection(new ArrayList<Object>(), transformer);
assertTrue("returned object should be a TransformedCollection", collection instanceof TransformedCollection); assertTrue("returned object should be a TransformedCollection", collection instanceof TransformedCollection);
try { try {
collection = CollectionUtils.transformingCollection(new ArrayList<Object>(), null); CollectionUtils.transformingCollection(new ArrayList<Object>(), null);
fail("Expecting IllegalArgumentException for null transformer."); fail("Expecting IllegalArgumentException for null transformer.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
} }
try { try {
collection = CollectionUtils.transformingCollection(null, transformer); CollectionUtils.transformingCollection(null, transformer);
fail("Expecting IllegalArgumentException for null collection."); fail("Expecting IllegalArgumentException for null collection.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -1484,7 +1484,7 @@ public class CollectionUtilsTest extends MockTestCase {
Collection<Object> col = CollectionUtils.synchronizedCollection(new ArrayList<Object>()); Collection<Object> col = CollectionUtils.synchronizedCollection(new ArrayList<Object>());
assertTrue("Returned object should be a SynchronizedCollection.", col instanceof SynchronizedCollection); assertTrue("Returned object should be a SynchronizedCollection.", col instanceof SynchronizedCollection);
try { try {
col = CollectionUtils.synchronizedCollection(null); CollectionUtils.synchronizedCollection(null);
fail("Expecting IllegalArgumentException for null collection."); fail("Expecting IllegalArgumentException for null collection.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
@ -1496,7 +1496,7 @@ public class CollectionUtilsTest extends MockTestCase {
Collection<Object> col = CollectionUtils.unmodifiableCollection(new ArrayList<Object>()); Collection<Object> col = CollectionUtils.unmodifiableCollection(new ArrayList<Object>());
assertTrue("Returned object should be a UnmodifiableCollection.", col instanceof UnmodifiableCollection); assertTrue("Returned object should be a UnmodifiableCollection.", col instanceof UnmodifiableCollection);
try { try {
col = CollectionUtils.unmodifiableCollection(null); CollectionUtils.unmodifiableCollection(null);
fail("Expecting IllegalArgumentException for null collection."); fail("Expecting IllegalArgumentException for null collection.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected

View File

@ -137,13 +137,13 @@ public class ListUtilsTest extends BulkTest {
List<Object> list = ListUtils.predicatedList(new ArrayList<Object>(), predicate); List<Object> list = ListUtils.predicatedList(new ArrayList<Object>(), predicate);
assertTrue("returned object should be a PredicatedList", list instanceof PredicatedList); assertTrue("returned object should be a PredicatedList", list instanceof PredicatedList);
try { try {
list = ListUtils.predicatedList(new ArrayList<Object>(), null); ListUtils.predicatedList(new ArrayList<Object>(), null);
fail("Expecting IllegalArgumentException for null predicate."); fail("Expecting IllegalArgumentException for null predicate.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
} }
try { try {
list = ListUtils.predicatedList(null, predicate); ListUtils.predicatedList(null, predicate);
fail("Expecting IllegalArgumentException for null list."); fail("Expecting IllegalArgumentException for null list.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected

View File

@ -77,7 +77,7 @@ public class MapUtilsTest extends BulkTest {
Map<Object, Object> map = MapUtils.predicatedMap(new HashMap<Object, Object>(), p, p); Map<Object, Object> map = MapUtils.predicatedMap(new HashMap<Object, Object>(), p, p);
assertTrue("returned object should be a PredicatedMap", map instanceof PredicatedMap); assertTrue("returned object should be a PredicatedMap", map instanceof PredicatedMap);
try { try {
map = MapUtils.predicatedMap(null, p, p); MapUtils.predicatedMap(null, p, p);
fail("Expecting IllegalArgumentException for null map."); fail("Expecting IllegalArgumentException for null map.");
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {
// expected // expected

View File

@ -54,13 +54,13 @@ public class SetUtilsTest extends BulkTest {
Set<Object> set = SetUtils.predicatedSet(new HashSet<Object>(), predicate); Set<Object> set = SetUtils.predicatedSet(new HashSet<Object>(), predicate);
assertTrue("returned object should be a PredicatedSet", set instanceof PredicatedSet); assertTrue("returned object should be a PredicatedSet", set instanceof PredicatedSet);
try { try {
set = SetUtils.predicatedSet(new HashSet<Object>(), null); SetUtils.predicatedSet(new HashSet<Object>(), null);
fail("Expecting IllegalArgumentException for null predicate."); fail("Expecting IllegalArgumentException for null predicate.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected
} }
try { try {
set = SetUtils.predicatedSet(null, predicate); SetUtils.predicatedSet(null, predicate);
fail("Expecting IllegalArgumentException for null set."); fail("Expecting IllegalArgumentException for null set.");
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
// expected // expected