Author: ggregory
Date: Mon Jan 7 16:55:07 2013
New Revision: 1429895
URL: http://svn.apache.org/viewvc?rev=1429895&view=rev
Log:
Convert control statement bodies to block.
Modified:
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/Flat3Map.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractBidiMapTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/PriorityBufferTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractIterableMapTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java
Modified:
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/Flat3Map.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/Flat3Map.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/Flat3Map.java
(original)
+++
commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/Flat3Map.java
Mon Jan 7 16:55:07 2013
@@ -131,11 +131,17 @@ public class Flat3Map<K, V> implements I
switch (size) {
// drop through
case 3:
- if (key3 == null) return value3;
+ if (key3 == null) {
+ return value3;
+ }
case 2:
- if (key2 == null) return value2;
+ if (key2 == null) {
+ return value2;
+ }
case 1:
- if (key1 == null) return value1;
+ if (key1 == null) {
+ return value1;
+ }
}
} else {
if (size > 0) {
@@ -143,11 +149,17 @@ public class Flat3Map<K, V> implements I
switch (size) {
// drop through
case 3:
- if (hash3 == hashCode && key.equals(key3)) return
value3;
+ if (hash3 == hashCode && key.equals(key3)) {
+ return value3;
+ }
case 2:
- if (hash2 == hashCode && key.equals(key2)) return
value2;
+ if (hash2 == hashCode && key.equals(key2)) {
+ return value2;
+ }
case 1:
- if (hash1 == hashCode && key.equals(key1)) return
value1;
+ if (hash1 == hashCode && key.equals(key1)) {
+ return value1;
+ }
}
}
}
@@ -189,22 +201,34 @@ public class Flat3Map<K, V> implements I
if (key == null) {
switch (size) { // drop through
case 3:
- if (key3 == null) return true;
+ if (key3 == null) {
+ return true;
+ }
case 2:
- if (key2 == null) return true;
+ if (key2 == null) {
+ return true;
+ }
case 1:
- if (key1 == null) return true;
+ if (key1 == null) {
+ return true;
+ }
}
} else {
if (size > 0) {
int hashCode = key.hashCode();
switch (size) { // drop through
case 3:
- if (hash3 == hashCode && key.equals(key3)) return true;
+ if (hash3 == hashCode && key.equals(key3)) {
+ return true;
+ }
case 2:
- if (hash2 == hashCode && key.equals(key2)) return true;
+ if (hash2 == hashCode && key.equals(key2)) {
+ return true;
+ }
case 1:
- if (hash1 == hashCode && key.equals(key1)) return true;
+ if (hash1 == hashCode && key.equals(key1)) {
+ return true;
+ }
}
}
}
@@ -224,20 +248,32 @@ public class Flat3Map<K, V> implements I
if (value == null) { // drop through
switch (size) {
case 3:
- if (value3 == null) return true;
+ if (value3 == null) {
+ return true;
+ }
case 2:
- if (value2 == null) return true;
+ if (value2 == null) {
+ return true;
+ }
case 1:
- if (value1 == null) return true;
+ if (value1 == null) {
+ return true;
+ }
}
} else {
switch (size) { // drop through
case 3:
- if (value.equals(value3)) return true;
+ if (value.equals(value3)) {
+ return true;
+ }
case 2:
- if (value.equals(value2)) return true;
+ if (value.equals(value2)) {
+ return true;
+ }
case 1:
- if (value.equals(value1)) return true;
+ if (value.equals(value1)) {
+ return true;
+ }
}
}
return false;
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/AbstractLinkedListTest.java
Mon Jan 7 16:55:07 2013
@@ -71,7 +71,9 @@ public abstract class AbstractLinkedList
*/
@SuppressWarnings("unchecked")
public void testLinkedListAddFirst() {
- if (!isAddSupported()) return;
+ if (!isAddSupported()) {
+ return;
+ }
T o = (T) "hello";
resetEmpty();
@@ -90,7 +92,9 @@ public abstract class AbstractLinkedList
*/
@SuppressWarnings("unchecked")
public void testLinkedListAddLast() {
- if (!isAddSupported()) return;
+ if (!isAddSupported()) {
+ return;
+ }
T o = (T) "hello";
resetEmpty();
@@ -152,7 +156,9 @@ public abstract class AbstractLinkedList
* Tests {@link LinkedList#removeFirst()}.
*/
public void testLinkedListRemoveFirst() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetEmpty();
try {
@@ -176,7 +182,9 @@ public abstract class AbstractLinkedList
* Tests {@link LinkedList#removeLast()}.
*/
public void testLinkedListRemoveLast() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetEmpty();
try {
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/BulkTest.java
Mon Jan 7 16:55:07 2013
@@ -324,8 +324,12 @@ class BulkTestSuiteMaker {
Class<? extends BulkTest> c = bulk.getClass();
Method[] all = c.getMethods();
for (Method element : all) {
- if (isTest(element)) addTest(bulk, element);
- if (isBulk(element)) addBulk(bulk, element);
+ if (isTest(element)) {
+ addTest(bulk, element);
+ }
+ if (isBulk(element)) {
+ addBulk(bulk, element);
+ }
}
}
@@ -341,7 +345,9 @@ class BulkTestSuiteMaker {
BulkTest bulk2 = (BulkTest)bulk.clone();
bulk2.setName(m.getName());
bulk2.verboseName = prefix + "." + m.getName();
- if (ignored.contains(bulk2.verboseName)) return;
+ if (ignored.contains(bulk2.verboseName)) {
+ return;
+ }
result.addTest(bulk2);
}
@@ -356,12 +362,16 @@ class BulkTestSuiteMaker {
*/
void addBulk(BulkTest bulk, Method m) {
String verboseName = prefix + "." + m.getName();
- if (ignored.contains(verboseName)) return;
+ if (ignored.contains(verboseName)) {
+ return;
+ }
BulkTest bulk2;
try {
bulk2 = (BulkTest)m.invoke(bulk, (Object[]) null);
- if (bulk2 == null) return;
+ if (bulk2 == null) {
+ return;
+ }
} catch (InvocationTargetException ex) {
ex.getTargetException().printStackTrace();
throw new Error(); // FIXME;
@@ -432,7 +442,9 @@ class BulkTestSuiteMaker {
private static <T extends BulkTest> BulkTest makeFirstTestCase(Class<T> c)
{
Method[] all = c.getMethods();
for (Method element : all) {
- if (isTest(element)) return makeTestCase(c, element);
+ if (isTest(element)) {
+ return makeTestCase(c, element);
+ }
}
throw new IllegalArgumentException(c.getName() + " must provide "
+ " at least one test method.");
@@ -442,12 +454,22 @@ class BulkTestSuiteMaker {
* Returns true if the given method is a simple test method.
*/
private static boolean isTest(Method m) {
- if (!m.getName().startsWith("test")) return false;
- if (m.getReturnType() != Void.TYPE) return false;
- if (m.getParameterTypes().length != 0) return false;
+ if (!m.getName().startsWith("test")) {
+ return false;
+ }
+ if (m.getReturnType() != Void.TYPE) {
+ return false;
+ }
+ if (m.getParameterTypes().length != 0) {
+ return false;
+ }
int mods = m.getModifiers();
- if (Modifier.isStatic(mods)) return false;
- if (Modifier.isAbstract(mods)) return false;
+ if (Modifier.isStatic(mods)) {
+ return false;
+ }
+ if (Modifier.isAbstract(mods)) {
+ return false;
+ }
return true;
}
@@ -455,12 +477,22 @@ class BulkTestSuiteMaker {
* Returns true if the given method is a bulk test method.
*/
private static boolean isBulk(Method m) {
- if (!m.getName().startsWith("bulkTest")) return false;
- if (m.getReturnType() != BulkTest.class) return false;
- if (m.getParameterTypes().length != 0) return false;
+ if (!m.getName().startsWith("bulkTest")) {
+ return false;
+ }
+ if (m.getReturnType() != BulkTest.class) {
+ return false;
+ }
+ if (m.getParameterTypes().length != 0) {
+ return false;
+ }
int mods = m.getModifiers();
- if (Modifier.isStatic(mods)) return false;
- if (Modifier.isAbstract(mods)) return false;
+ if (Modifier.isStatic(mods)) {
+ return false;
+ }
+ if (Modifier.isAbstract(mods)) {
+ return false;
+ }
return true;
}
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/AbstractBagTest.java
Mon Jan 7 16:55:07 2013
@@ -454,7 +454,9 @@ public abstract class AbstractBagTest<T>
//-----------------------------------------------------------------------
public void testEmptyBagSerialization() throws IOException,
ClassNotFoundException {
Bag<T> bag = makeObject();
- if (!(bag instanceof Serializable && isTestSerialization())) return;
+ if (!(bag instanceof Serializable && isTestSerialization())) {
+ return;
+ }
byte[] objekt = writeExternalFormToBytes((Serializable) bag);
Bag<?> bag2 = (Bag<?>) readExternalFormFromBytes(objekt);
@@ -472,7 +474,9 @@ public abstract class AbstractBagTest<T>
bag.add((T) "B");
bag.add((T) "C");
int size = bag.size();
- if (!(bag instanceof Serializable && isTestSerialization())) return;
+ if (!(bag instanceof Serializable && isTestSerialization())) {
+ return;
+ }
byte[] objekt = writeExternalFormToBytes((Serializable) bag);
Bag<?> bag2 = (Bag<?>) readExternalFormFromBytes(objekt);
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractBidiMapTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractBidiMapTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractBidiMapTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractBidiMapTest.java
Mon Jan 7 16:55:07 2013
@@ -80,7 +80,9 @@ public abstract class AbstractBidiMapTes
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testBidiPut() {
- if (isPutAddSupported() == false || isPutChangeSupported() == false)
return;
+ if (isPutAddSupported() == false || isPutChangeSupported() == false) {
+ return;
+ }
BidiMap<K, V> map = makeObject();
BidiMap<V, K> inverse = map.inverseBidiMap();
@@ -179,7 +181,9 @@ public abstract class AbstractBidiMapTes
//-----------------------------------------------------------------------
public void testBidiModifyEntrySet() {
- if (isSetValueSupported() == false) return;
+ if (isSetValueSupported() == false) {
+ return;
+ }
modifyEntrySet(makeFullMap());
modifyEntrySet(makeFullMap().inverseBidiMap());
@@ -282,7 +286,9 @@ public abstract class AbstractBidiMapTes
//-----------------------------------------------------------------------
public void testBidiRemoveByKeySet() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
removeByKeySet(makeFullMap(), getSampleKeys()[0],
getSampleValues()[0]);
removeByKeySet(makeFullMap().inverseBidiMap(), getSampleValues()[0],
getSampleKeys()[0]);
@@ -304,7 +310,9 @@ public abstract class AbstractBidiMapTes
//-----------------------------------------------------------------------
public void testBidiRemoveByEntrySet() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
removeByEntrySet(makeFullMap(), getSampleKeys()[0],
getSampleValues()[0]);
removeByEntrySet(makeFullMap().inverseBidiMap(), getSampleValues()[0],
getSampleKeys()[0]);
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bidimap/AbstractSortedBidiMapTest.java
Mon Jan 7 16:55:07 2013
@@ -129,7 +129,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiClearByHeadMap() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
@@ -174,7 +176,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiRemoveByHeadMap() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
@@ -216,7 +220,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiRemoveByHeadMapEntrySet() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
@@ -297,7 +303,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiClearByTailMap() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
@@ -344,7 +352,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiRemoveByTailMap() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
@@ -387,7 +397,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiRemoveByTailMapEntrySet() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
@@ -475,7 +487,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiClearBySubMap() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
@@ -530,7 +544,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiRemoveBySubMap() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
@@ -574,7 +590,9 @@ public abstract class AbstractSortedBidi
//-----------------------------------------------------------------------
public void testBidiRemoveBySubMapEntrySet() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
// extra test as other tests get complex
SortedBidiMap<K, V> sm = makeFullMap();
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/PriorityBufferTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/PriorityBufferTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/PriorityBufferTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/buffer/PriorityBufferTest.java
Mon Jan 7 16:55:07 2013
@@ -329,8 +329,9 @@ public class PriorityBufferTest<E> exten
StringBuilder buffer = new StringBuilder();
for (int offset = 1; count < h.size() + 1; offset *= 2) {
for (int i = offset; i < offset * 2; i++) {
- if (i < h.elements.length && h.elements[i] != null)
+ if (i < h.elements.length && h.elements[i] != null) {
buffer.append(h.elements[i] + " ");
+ }
count++;
}
buffer.append('\n');
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/AbstractCollectionTest.java
Mon Jan 7 16:55:07 2013
@@ -497,7 +497,9 @@ public abstract class AbstractCollection
* Tests {@link Collection#add(Object)}.
*/
public void testCollectionAdd() {
- if (!isAddSupported()) return;
+ if (!isAddSupported()) {
+ return;
+ }
E[] elements = getFullElements();
for (E element : elements) {
@@ -515,7 +517,9 @@ public abstract class AbstractCollection
boolean r = getCollection().add(element);
getConfirmed().add(element);
verify();
- if (r) size++;
+ if (r) {
+ size++;
+ }
assertEquals("Collection size should grow after add", size,
getCollection().size());
assertTrue("Collection should contain added element",
getCollection().contains(element));
}
@@ -525,7 +529,9 @@ public abstract class AbstractCollection
* Tests {@link Collection#addAll(Collection)}.
*/
public void testCollectionAddAll() {
- if (!isAddSupported()) return;
+ if (!isAddSupported()) {
+ return;
+ }
resetEmpty();
E[] elements = getFullElements();
@@ -567,7 +573,9 @@ public abstract class AbstractCollection
* raise <code>UnsupportedOperationException.
*/
public void testUnsupportedAdd() {
- if (isAddSupported()) return;
+ if (isAddSupported()) {
+ return;
+ }
resetEmpty();
try {
@@ -616,7 +624,9 @@ public abstract class AbstractCollection
* Test {@link Collection#clear()}.
*/
public void testCollectionClear() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetEmpty();
getCollection().clear(); // just to make sure it doesn't raise anything
@@ -776,7 +786,9 @@ public abstract class AbstractCollection
*/
@SuppressWarnings("unchecked")
public void testCollectionIteratorRemove() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetEmpty();
try {
@@ -844,7 +856,9 @@ public abstract class AbstractCollection
* Tests {@link Collection#remove(Object)}.
*/
public void testCollectionRemove() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetEmpty();
E[] elements = getFullElements();
@@ -888,7 +902,9 @@ public abstract class AbstractCollection
* Tests {@link Collection#removeAll(Collection)}.
*/
public void testCollectionRemoveAll() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetEmpty();
assertTrue("Empty collection removeAll should return false for empty
input",
@@ -935,7 +951,9 @@ public abstract class AbstractCollection
* Tests {@link Collection#retainAll(Collection)}.
*/
public void testCollectionRetainAll() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetEmpty();
List<E> elements = Arrays.asList(getFullElements());
@@ -1029,8 +1047,9 @@ public abstract class AbstractCollection
// find a match in the confirmed array
for (int j = 0; j < array.length; j++) {
// skip already matched
- if (matched[j])
+ if (matched[j]) {
continue;
+ }
if (array[i] == confirmedArray[j]
|| (array[i] != null &&
array[i].equals(confirmedArray[j]))) {
matched[j] = true;
@@ -1088,7 +1107,9 @@ public abstract class AbstractCollection
for (Object element : array) {
classes.add((element == null) ? null : element.getClass());
}
- if (classes.size() > 1) return;
+ if (classes.size() > 1) {
+ return;
+ }
Class<?> cl = classes.iterator().next();
if (Map.Entry.class.isAssignableFrom(cl)) { // check needed for
protective cases like Predicated/Unmod map entrySet
@@ -1120,7 +1141,9 @@ public abstract class AbstractCollection
* operations raise an UnsupportedOperationException.
*/
public void testUnsupportedRemove() {
- if (isRemoveSupported()) return;
+ if (isRemoveSupported()) {
+ return;
+ }
resetEmpty();
try {
@@ -1172,7 +1195,9 @@ public abstract class AbstractCollection
* Tests that the collection's iterator is fail-fast.
*/
public void testCollectionIteratorFailFast() {
- if (!isFailFastSupported()) return;
+ if (!isFailFastSupported()) {
+ return;
+ }
if (isAddSupported()) {
resetFull();
@@ -1201,7 +1226,9 @@ public abstract class AbstractCollection
verify();
}
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetFull();
try {
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java
Mon Jan 7 16:55:07 2013
@@ -115,7 +115,9 @@ public abstract class AbstractLinkedList
@SuppressWarnings("unchecked")
public void testRemoveNode() {
resetEmpty();
- if (isAddSupported() == false || isRemoveSupported() == false) return;
+ if (isAddSupported() == false || isRemoveSupported() == false) {
+ return;
+ }
AbstractLinkedList<E> list = getCollection();
list.addAll(Arrays.asList((E[]) new String[] { "value1", "value2" }));
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java
Mon Jan 7 16:55:07 2013
@@ -572,7 +572,9 @@ public abstract class AbstractListTest<E
* full list.
*/
public void testListSetByIndexBoundsChecking2() {
- if (!isSetSupported()) return;
+ if (!isSetSupported()) {
+ return;
+ }
List<E> list = makeFullCollection();
E element = getOtherElements()[0];
@@ -613,7 +615,9 @@ public abstract class AbstractListTest<E
* Test {@link List#set(int,Object)}.
*/
public void testListSetByIndex() {
- if (!isSetSupported()) return;
+ if (!isSetSupported()) {
+ return;
+ }
resetFull();
E[] elements = getFullElements();
@@ -633,7 +637,9 @@ public abstract class AbstractListTest<E
* raises <Code>UnsupportedOperationException.
*/
public void testUnsupportedSet() {
- if (isSetSupported()) return;
+ if (isSetSupported()) {
+ return;
+ }
resetFull();
try {
@@ -652,7 +658,9 @@ public abstract class AbstractListTest<E
* empty list.
*/
public void testListRemoveByIndexBoundsChecking() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
List<E> list = makeObject();
@@ -697,7 +705,9 @@ public abstract class AbstractListTest<E
* full list.
*/
public void testListRemoveByIndexBoundsChecking2() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
List<E> list = makeFullCollection();
@@ -737,7 +747,9 @@ public abstract class AbstractListTest<E
* Tests {@link List#remove(int)}.
*/
public void testListRemoveByIndex() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
int max = getFullElements().length;
for (int i = 0; i < max; i++) {
@@ -786,9 +798,13 @@ public abstract class AbstractListTest<E
* Tests remove on list iterator is correct.
*/
public void testListListIteratorPreviousRemoveNext() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
resetFull();
- if (getCollection().size() < 4) return;
+ if (getCollection().size() < 4) {
+ return;
+ }
ListIterator<E> it = getCollection().listIterator();
E zero = it.next();
E one = it.next();
@@ -814,9 +830,13 @@ public abstract class AbstractListTest<E
* Tests remove on list iterator is correct.
*/
public void testListListIteratorPreviousRemovePrevious() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
resetFull();
- if (getCollection().size() < 4) return;
+ if (getCollection().size() < 4) {
+ return;
+ }
ListIterator<E> it = getCollection().listIterator();
E zero = it.next();
E one = it.next();
@@ -842,9 +862,13 @@ public abstract class AbstractListTest<E
* Tests remove on list iterator is correct.
*/
public void testListListIteratorNextRemoveNext() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
resetFull();
- if (getCollection().size() < 4) return;
+ if (getCollection().size() < 4) {
+ return;
+ }
ListIterator<E> it = getCollection().listIterator();
E zero = it.next();
E one = it.next();
@@ -867,9 +891,13 @@ public abstract class AbstractListTest<E
* Tests remove on list iterator is correct.
*/
public void testListListIteratorNextRemovePrevious() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
resetFull();
- if (getCollection().size() < 4) return;
+ if (getCollection().size() < 4) {
+ return;
+ }
ListIterator<E> it = getCollection().listIterator();
E zero = it.next();
E one = it.next();
@@ -964,7 +992,9 @@ public abstract class AbstractListTest<E
* iterator.
*/
public void testListIteratorAdd() {
- if (!isAddSupported()) return;
+ if (!isAddSupported()) {
+ return;
+ }
resetEmpty();
List<E> list1 = getCollection();
@@ -997,7 +1027,9 @@ public abstract class AbstractListTest<E
* iterator.
*/
public void testListIteratorSet() {
- if (!isSetSupported()) return;
+ if (!isSetSupported()) {
+ return;
+ }
E[] elements = getFullElements();
@@ -1016,7 +1048,9 @@ public abstract class AbstractListTest<E
@SuppressWarnings("unchecked")
public void testEmptyListSerialization() throws IOException,
ClassNotFoundException {
List<E> list = makeObject();
- if (!(list instanceof Serializable && isTestSerialization())) return;
+ if (!(list instanceof Serializable && isTestSerialization())) {
+ return;
+ }
byte[] objekt = writeExternalFormToBytes((Serializable) list);
List<E> list2 = (List<E>) readExternalFormFromBytes(objekt);
@@ -1029,7 +1063,9 @@ public abstract class AbstractListTest<E
public void testFullListSerialization() throws IOException,
ClassNotFoundException {
List<E> list = makeFullCollection();
int size = getFullElements().length;
- if (!(list instanceof Serializable && isTestSerialization())) return;
+ if (!(list instanceof Serializable && isTestSerialization())) {
+ return;
+ }
byte[] objekt = writeExternalFormToBytes((Serializable) list);
List<E> list2 = (List<E>) readExternalFormFromBytes(objekt);
@@ -1113,7 +1149,9 @@ public abstract class AbstractListTest<E
* modified when the sublist is.
*/
public BulkTest bulkTestSubList() {
- if (getFullElements().length - 6 < 10) return null;
+ if (getFullElements().length - 6 < 10) {
+ return null;
+ }
return new BulkTestSubList<E>(this);
}
@@ -1196,8 +1234,12 @@ public abstract class AbstractListTest<E
* if elements are added to the original list.
*/
public void testListSubListFailFastOnAdd() {
- if (!isFailFastSupported()) return;
- if (!isAddSupported()) return;
+ if (!isFailFastSupported()) {
+ return;
+ }
+ if (!isAddSupported()) {
+ return;
+ }
resetFull();
int size = getCollection().size();
@@ -1226,8 +1268,12 @@ public abstract class AbstractListTest<E
* if elements are removed from the original list.
*/
public void testListSubListFailFastOnRemove() {
- if (!isFailFastSupported()) return;
- if (!isRemoveSupported()) return;
+ if (!isFailFastSupported()) {
+ return;
+ }
+ if (!isRemoveSupported()) {
+ return;
+ }
resetFull();
int size = getCollection().size();
@@ -1280,7 +1326,9 @@ public abstract class AbstractListTest<E
* @param m the method to invoke
*/
protected void failFastMethod(List<E> list, Method m) {
- if (m.getName().equals("equals")) return;
+ if (m.getName().equals("equals")) {
+ return;
+ }
E element = getOtherElements()[0];
Collection<E> c = Collections.singleton(element);
@@ -1288,10 +1336,15 @@ public abstract class AbstractListTest<E
Class<?>[] types = m.getParameterTypes();
Object[] params = new Object[types.length];
for (int i = 0; i < params.length; i++) {
- if (types[i] == Integer.TYPE) params[i] = new Integer(0);
- else if (types[i] == Collection.class) params[i] = c;
- else if (types[i] == Object.class) params[i] = element;
- else if (types[i] == Object[].class) params[i] = new Object[0];
+ if (types[i] == Integer.TYPE) {
+ params[i] = new Integer(0);
+ } else if (types[i] == Collection.class) {
+ params[i] = c;
+ } else if (types[i] == Object.class) {
+ params[i] = element;
+ } else if (types[i] == Object[].class) {
+ params[i] = new Object[0];
+ }
}
try {
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java
Mon Jan 7 16:55:07 2013
@@ -55,7 +55,9 @@ public class NodeCachingLinkedListTest<E
//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
public void testShrinkCache() {
- if (isRemoveSupported() == false || isAddSupported() == false) return;
+ if (isRemoveSupported() == false || isAddSupported() == false) {
+ return;
+ }
resetEmpty();
NodeCachingLinkedList<E> list = getCollection();
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractIterableMapTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractIterableMapTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractIterableMapTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractIterableMapTest.java
Mon Jan 7 16:55:07 2013
@@ -59,8 +59,12 @@ public abstract class AbstractIterableMa
//-----------------------------------------------------------------------
public void testFailFastEntrySet() {
- if (isRemoveSupported() == false) return;
- if (isFailFastExpected() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
+ if (isFailFastExpected() == false) {
+ return;
+ }
resetFull();
Iterator<Map.Entry<K, V>> it = getMap().entrySet().iterator();
Map.Entry<K, V> val = it.next();
@@ -81,8 +85,12 @@ public abstract class AbstractIterableMa
}
public void testFailFastKeySet() {
- if (isRemoveSupported() == false) return;
- if (isFailFastExpected() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
+ if (isFailFastExpected() == false) {
+ return;
+ }
resetFull();
Iterator<K> it = getMap().keySet().iterator();
K val = it.next();
@@ -103,8 +111,12 @@ public abstract class AbstractIterableMa
}
public void testFailFastValues() {
- if (isRemoveSupported() == false) return;
- if (isFailFastExpected() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
+ if (isFailFastExpected() == false) {
+ return;
+ }
resetFull();
Iterator<V> it = getMap().values().iterator();
it.next();
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractMapTest.java
Mon Jan 7 16:55:07 2013
@@ -1028,7 +1028,9 @@ public abstract class AbstractMapTest<K,
* the underlying map for clear().
*/
public void testValuesClearChangesMap() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
// clear values, reflected in map
resetFull();
@@ -1054,7 +1056,9 @@ public abstract class AbstractMapTest<K,
* the underlying map for clear().
*/
public void testKeySetClearChangesMap() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
// clear values, reflected in map
resetFull();
@@ -1080,7 +1084,9 @@ public abstract class AbstractMapTest<K,
* the underlying map for clear().
*/
public void testEntrySetClearChangesMap() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
// clear values, reflected in map
resetFull();
@@ -1129,7 +1135,9 @@ public abstract class AbstractMapTest<K,
}
public void testEntrySetRemove1() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetFull();
int size = getMap().size();
Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
@@ -1142,7 +1150,9 @@ public abstract class AbstractMapTest<K,
}
public void testEntrySetRemove2() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetFull();
int size = getMap().size();
Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
@@ -1157,7 +1167,9 @@ public abstract class AbstractMapTest<K,
@SuppressWarnings("unchecked")
public void testEntrySetRemove3() {
- if (!isRemoveSupported()) return;
+ if (!isRemoveSupported()) {
+ return;
+ }
resetFull();
int size = getMap().size();
Set<Map.Entry<K, V>> entrySet = getMap().entrySet();
@@ -1684,7 +1696,9 @@ public abstract class AbstractMapTest<K,
}
public void testMapEntrySetRemoveNonMapEntry() {
- if (isRemoveSupported() == false) return;
+ if (isRemoveSupported() == false) {
+ return;
+ }
resetFull();
assertEquals(false, getCollection().remove(null));
assertEquals(false, getCollection().remove(new Object()));
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/AbstractSortedMapTest.java
Mon Jan 7 16:55:07 2013
@@ -238,7 +238,9 @@ public abstract class AbstractSortedMapT
return ((SortedMap<K, V>) main.makeFullMap()).headMap(toKey);
}
public void testHeadMapOutOfRange() {
- if (isPutAddSupported() == false) return;
+ if (isPutAddSupported() == false) {
+ return;
+ }
resetEmpty();
try {
getMap().put(toKey, subSortedValues.get(0));
@@ -291,7 +293,9 @@ public abstract class AbstractSortedMapT
return ((SortedMap<K, V>) main.makeFullMap()).tailMap(fromKey);
}
public void testTailMapOutOfRange() {
- if (isPutAddSupported() == false) return;
+ if (isPutAddSupported() == false) {
+ return;
+ }
resetEmpty();
try {
getMap().put(invalidKey, subSortedValues.get(0));
@@ -351,7 +355,9 @@ public abstract class AbstractSortedMapT
return ((SortedMap<K, V>) main.makeFullMap()).subMap(fromKey,
toKey);
}
public void testSubMapOutOfRange() {
- if (isPutAddSupported() == false) return;
+ if (isPutAddSupported() == false) {
+ return;
+ }
resetEmpty();
try {
getMap().put(toKey, subSortedValues.get(0));
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LRUMapTest.java
Mon Jan 7 16:55:07 2013
@@ -70,7 +70,9 @@ public class LRUMapTest<K, V> extends Ab
//-----------------------------------------------------------------------
public void testLRU() {
- if (isPutAddSupported() == false || isPutChangeSupported() == false)
return;
+ if (isPutAddSupported() == false || isPutChangeSupported() == false) {
+ return;
+ }
K[] keys = getSampleKeys();
V[] values = getSampleValues();
Iterator<K> kit;
@@ -150,7 +152,9 @@ public class LRUMapTest<K, V> extends Ab
//-----------------------------------------------------------------------
public void testAccessOrder() {
- if (isPutAddSupported() == false || isPutChangeSupported() == false)
return;
+ if (isPutAddSupported() == false || isPutChangeSupported() == false) {
+ return;
+ }
K[] keys = getSampleKeys();
V[] values = getSampleValues();
Iterator<K> kit = null;
@@ -364,7 +368,9 @@ public class LRUMapTest<K, V> extends Ab
@SuppressWarnings("unchecked")
public void testInternalState_Buckets() {
- if (isPutAddSupported() == false || isPutChangeSupported() == false)
return;
+ if (isPutAddSupported() == false || isPutChangeSupported() == false) {
+ return;
+ }
SingleHashCode one = new SingleHashCode("1");
SingleHashCode two = new SingleHashCode("2");
SingleHashCode three = new SingleHashCode("3");
@@ -452,7 +458,9 @@ public class LRUMapTest<K, V> extends Ab
@SuppressWarnings("unchecked")
public void testInternalState_getEntry_int() {
- if (isPutAddSupported() == false || isPutChangeSupported() == false)
return;
+ if (isPutAddSupported() == false || isPutChangeSupported() == false) {
+ return;
+ }
SingleHashCode one = new SingleHashCode("1");
SingleHashCode two = new SingleHashCode("2");
SingleHashCode three = new SingleHashCode("3");
Modified:
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java?rev=1429895&r1=1429894&r2=1429895&view=diff
==============================================================================
---
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java
(original)
+++
commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/map/LinkedMapTest.java
Mon Jan 7 16:55:07 2013
@@ -82,7 +82,9 @@ public class LinkedMapTest<K, V> extends
//-----------------------------------------------------------------------
public void testInsertionOrder() {
- if (isPutAddSupported() == false || isPutChangeSupported() == false)
return;
+ if (isPutAddSupported() == false || isPutChangeSupported() == false) {
+ return;
+ }
K[] keys = getSampleKeys();
V[] values = getSampleValues();
Iterator<K> keyIter;