BAEL-964 - Changing assertions within invert test
This commit is contained in:
parent
f8bf4038f1
commit
e96690ef20
|
@ -4,14 +4,19 @@ import org.apache.commons.collections4.MapIterator;
|
|||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.collections4.PredicateUtils;
|
||||
import org.apache.commons.collections4.TransformerUtils;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.collection.IsMapContaining.hasEntry;
|
||||
import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;
|
||||
|
@ -85,19 +90,12 @@ public class MapUtilsTest {
|
|||
@Test
|
||||
public void whenInvertMap_thenMustReturnInvertedMap() {
|
||||
Map<String, String> invColorMap = MapUtils.invertMap(this.colorMap);
|
||||
assertEquals(this.colorMap.size(), invColorMap.size());
|
||||
|
||||
MapIterator<String, String> itColorMap
|
||||
= MapUtils.iterableMap(this.colorMap).mapIterator();
|
||||
|
||||
while (itColorMap.hasNext()) {
|
||||
String colorMapKey = itColorMap.next();
|
||||
String colorMapValue = itColorMap.getValue();
|
||||
|
||||
String invColorMapValue = MapUtils.getString(invColorMap, colorMapValue);
|
||||
|
||||
assertTrue(invColorMapValue.equals(colorMapKey));
|
||||
}
|
||||
int size = invColorMap.size();
|
||||
Assertions.assertThat(invColorMap)
|
||||
.hasSameSizeAs(colorMap)
|
||||
.containsKeys(this.colorMap.values().toArray(new String[size]))
|
||||
.containsValues(this.colorMap.keySet().toArray(new String[size]));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
|
Loading…
Reference in New Issue