Fixed nested tests

This commit is contained in:
Harald Kuhr
2026-05-04 17:20:57 +02:00
parent 4f6ed55218
commit c709fcafa9
9 changed files with 82 additions and 51 deletions
@@ -327,5 +327,4 @@ public abstract class ObjectAbstractTest {
return new Cloneable() {};
}
}
}
@@ -30,6 +30,8 @@
package com.twelvemonkeys.util;
import org.junit.jupiter.api.Nested;
import java.beans.IntrospectionException;
import java.io.Serializable;
import java.util.Map;
@@ -172,4 +174,16 @@ public class BeanMapTest extends MapAbstractTest {
}
static class NullBean implements Serializable { }
@Nested
public class TestBeanMapEntrySet extends TestMapEntrySet {
}
@Nested
public class TestBeanMapKeySet extends TestMapKeySet {
}
@Nested
public class TestBeanMapValues extends TestMapValues {
}
}
@@ -436,24 +436,24 @@ public abstract class CollectionAbstractTest extends ObjectAbstractTest {
*/
public Object[] getFullNonNullElements() {
return new Object[] {
new String(""),
new String("One"),
new Integer(2),
"Three",
new Integer(4),
"",
"One",
new Double(5),
new Float(6),
2,
"Three",
4,
"One",
5.0,
6F,
"Seven",
"Eight",
new String("Nine"),
new Integer(10),
new Short((short)11),
new Long(12),
"Nine",
10,
(short) 11,
12L,
"Thirteen",
"14",
"15",
new Byte((byte)16)
(byte) 16
};
}
@@ -1149,7 +1149,7 @@ public abstract class CollectionAbstractTest extends ObjectAbstractTest {
public void testUnsupportedRemove() {
if (isRemoveSupported()) return;
resetEmpty();
resetFull();
try {
collection.clear();
fail("clear should raise UnsupportedOperationException");
@@ -1159,7 +1159,7 @@ public abstract class CollectionAbstractTest extends ObjectAbstractTest {
verifyAll();
try {
collection.remove(null);
collection.remove(getFullElements()[0]);
fail("remove should raise UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
// expected
@@ -1167,7 +1167,7 @@ public abstract class CollectionAbstractTest extends ObjectAbstractTest {
verifyAll();
try {
collection.removeAll(null);
collection.removeAll(Arrays.asList(getFullElements()));
fail("removeAll should raise UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
// expected
@@ -1175,7 +1175,7 @@ public abstract class CollectionAbstractTest extends ObjectAbstractTest {
verifyAll();
try {
collection.retainAll(null);
collection.retainAll(Collections.emptySet());
fail("removeAll should raise UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
// expected
@@ -1192,7 +1192,6 @@ public abstract class CollectionAbstractTest extends ObjectAbstractTest {
// expected
}
verifyAll();
}
@@ -212,5 +212,17 @@ public class LRUMapTest extends LinkedMapTest {
list.add(pEntry.getKey());
}
}
@Nested
public class TestLRUMapEntrySet extends TestMapEntrySet {
}
@Nested
public class TestLRUMapKeySet extends TestMapKeySet {
}
@Nested
public class TestLRUMapValues extends TestMapValues {
}
}
@@ -201,4 +201,16 @@ public class LinkedMapTest extends MapAbstractTest {
public void tearDown() throws Exception {
labRat = null;
}
@Nested
public class TestLinkedMapEntrySet extends TestMapEntrySet {
}
@Nested
public class TestLinkedMapKeySet extends TestMapKeySet {
}
@Nested
public class TestLinkedMapValues extends TestMapValues {
}
}
@@ -1255,8 +1255,7 @@ public abstract class MapAbstractTest extends ObjectAbstractTest {
}
*/
@Nested
public class TestMapEntrySet extends SetAbstractTest {
protected abstract class TestMapEntrySet extends SetAbstractTest {
// Have to implement manually; entrySet doesn't support addAll
public Object[] getFullElements() {
@@ -1430,8 +1429,7 @@ public abstract class MapAbstractTest extends ObjectAbstractTest {
}
*/
@Nested
public class TestMapKeySet extends SetAbstractTest {
protected abstract class TestMapKeySet extends SetAbstractTest {
public Object[] getFullElements() {
return getSampleKeys();
}
@@ -1497,8 +1495,7 @@ public abstract class MapAbstractTest extends ObjectAbstractTest {
}
*/
@Nested
public class TestMapValues extends CollectionAbstractTest {
protected abstract class TestMapValues extends CollectionAbstractTest {
public Object[] getFullElements() {
return getSampleValues();
}
@@ -668,5 +668,17 @@ public class TimeoutMapTest extends MapAbstractTest {
assertFalse(timeoutMap.containsKey("xyz"));
assertNull(timeoutMap.get("xyz"));
}
@Nested
public class TestTimeoutMapEntrySet extends TestMapEntrySet {
}
@Nested
public class TestTimeoutMapKeySet extends TestMapKeySet {
}
@Nested
public class TestTimeoutMapValues extends TestMapValues {
}
}