Skip to content

Commit

Permalink
Use JUnit Assumptions
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Mar 31, 2024
1 parent 450ed71 commit dea79e6
Showing 1 changed file with 10 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import static org.junit.jupiter.api.Assumptions.assumeFalse;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -701,9 +700,7 @@ public void setConfirmed(final MultiValuedMap<K, V> map) {
@Test
@SuppressWarnings("unchecked")
public void testAddMappingThroughGet() {
if (!isAddSupported()) {
return;
}
assumeTrue(isAddSupported());
resetEmpty();
final MultiValuedMap<K, V> map = getMap();
final Collection<V> col1 = map.get((K) "k0");
Expand Down Expand Up @@ -971,9 +968,7 @@ public void testKeysMultiSet() {
@Test
@SuppressWarnings("unchecked")
public void testMapEquals() {
if (!isAddSupported()) {
return;
}
assumeTrue(isAddSupported());
final MultiValuedMap<K, V> one = makeObject();
final Integer value = Integer.valueOf(1);
one.put((K) "One", (V) value);
Expand Down Expand Up @@ -1080,9 +1075,7 @@ public void testNoMappingReturnsEmptyCol() {
@Test
@SuppressWarnings("unchecked")
public void testPutAll_KeyIterable() {
if (!isAddSupported()) {
return;
}
assumeTrue(isAddSupported());
final MultiValuedMap<K, V> map = makeObject();
Collection<V> coll = (Collection<V>) Arrays.asList("X", "Y", "Z");

Expand Down Expand Up @@ -1118,9 +1111,7 @@ public void testPutAll_KeyIterable() {
@Test
@SuppressWarnings("unchecked")
public void testPutAll_Map1() {
if (!isAddSupported()) {
return;
}
assumeTrue(isAddSupported());
final MultiValuedMap<K, V> original = makeObject();
original.put((K) "key", (V) "object1");
original.put((K) "key", (V) "object2");
Expand All @@ -1147,9 +1138,7 @@ public void testPutAll_Map1() {
@Test
@SuppressWarnings("unchecked")
public void testPutAll_Map2() {
if (!isAddSupported()) {
return;
}
assumeTrue(isAddSupported());
final Map<K, V> original = new HashMap<>();
original.put((K) "keyX", (V) "object1");
original.put((K) "keyY", (V) "object2");
Expand Down Expand Up @@ -1177,9 +1166,8 @@ public void testPutAll_Map2() {
@Test
@SuppressWarnings("unchecked")
public void testRemove_KeyItem() {
if (!isRemoveSupported() || !isAddSupported()) {
return;
}
assumeTrue(isAddSupported());
assumeTrue(isRemoveSupported());
final MultiValuedMap<K, V> map = makeObject();
map.put((K) "A", (V) "AA");
map.put((K) "A", (V) "AB");
Expand Down Expand Up @@ -1325,9 +1313,8 @@ public void testSize_Key() {
@Test
@SuppressWarnings("unchecked")
public void testSizeWithPutRemove() {
if (!isRemoveSupported() || !isAddSupported()) {
return;
}
assumeTrue(isAddSupported());
assumeTrue(isRemoveSupported());
final MultiValuedMap<K, V> map = makeObject();
assertEquals(0, map.size());
map.put((K) "A", (V) "AA");
Expand All @@ -1346,9 +1333,7 @@ public void testSizeWithPutRemove() {

@Test
public void testToString(){
if (!isAddSupported()) {
return;
}
assumeTrue(isAddSupported());
final MultiValuedMap<K, V> map = makeObject();
map.put((K) "A", (V) "X");
map.put((K) "A", (V) "Y");
Expand Down

0 comments on commit dea79e6

Please sign in to comment.