diff --git a/pom.xml b/pom.xml
index fdd38fc556..95ebfe1b82 100644
--- a/pom.xml
+++ b/pom.xml
@@ -131,12 +131,12 @@ The MIT License (MIT)
junit
4.13
test
-
-
- org.hamcrest
- hamcrest-core
- 1.3
- test
+
+
+ org.hamcrest
+ hamcrest-core
+
+
diff --git a/src/test/java/org/cactoos/bytes/BytesOfTest.java b/src/test/java/org/cactoos/bytes/BytesOfTest.java
index 5e6382594d..cd5f684435 100644
--- a/src/test/java/org/cactoos/bytes/BytesOfTest.java
+++ b/src/test/java/org/cactoos/bytes/BytesOfTest.java
@@ -34,7 +34,6 @@
import org.cactoos.io.Sticky;
import org.cactoos.iterable.Endless;
import org.cactoos.iterable.HeadOf;
-import org.cactoos.iterable.IterableOf;
import org.cactoos.iterable.IterableOfBytes;
import org.cactoos.iterator.IteratorOfBytes;
import org.cactoos.text.Concatenated;
@@ -89,10 +88,8 @@ void readsInputIntoBytes() throws Exception {
)
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith("Hello, "),
- new EndsWith("друг!")
- )
+ new StartsWith("Hello, "),
+ new EndsWith("друг!")
)
).affirm();
}
@@ -130,10 +127,8 @@ void readsInputIntoBytesWithSmallBuffer() throws Exception {
)
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith("Hello,"),
- new EndsWith("товарищ!")
- )
+ new StartsWith("Hello,"),
+ new EndsWith("товарищ!")
)
).affirm();
}
diff --git a/src/test/java/org/cactoos/bytes/InputAsBytesTest.java b/src/test/java/org/cactoos/bytes/InputAsBytesTest.java
index 5695935b95..dc4faf6e75 100644
--- a/src/test/java/org/cactoos/bytes/InputAsBytesTest.java
+++ b/src/test/java/org/cactoos/bytes/InputAsBytesTest.java
@@ -29,7 +29,6 @@
import org.cactoos.io.SlowInputStream;
import org.cactoos.iterable.Endless;
import org.cactoos.iterable.HeadOf;
-import org.cactoos.iterable.IterableOf;
import org.cactoos.text.TextOf;
import org.hamcrest.core.AllOf;
import org.hamcrest.core.IsEqual;
@@ -98,10 +97,8 @@ void readsInputIntoBytes() throws Exception {
StandardCharsets.UTF_8
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith("Hello, "),
- new EndsWith("друг!")
- )
+ new StartsWith("Hello, "),
+ new EndsWith("друг!")
)
).affirm();
}
@@ -122,10 +119,8 @@ void readsInputIntoBytesWithSmallBuffer() throws Exception {
StandardCharsets.UTF_8
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith("Hello,"),
- new EndsWith("товарищ!")
- )
+ new StartsWith("Hello,"),
+ new EndsWith("товарищ!")
)
).affirm();
}
diff --git a/src/test/java/org/cactoos/collection/BehavesAsCollection.java b/src/test/java/org/cactoos/collection/BehavesAsCollection.java
index d74698b2f0..6979b91476 100644
--- a/src/test/java/org/cactoos/collection/BehavesAsCollection.java
+++ b/src/test/java/org/cactoos/collection/BehavesAsCollection.java
@@ -29,10 +29,10 @@
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.collection.IsCollectionWithSize;
import org.hamcrest.collection.IsEmptyCollection;
-import org.hamcrest.core.IsCollectionContaining;
import org.hamcrest.core.IsEqual;
import org.hamcrest.core.IsNot;
import org.llorllale.cactoos.matchers.Assertion;
+import org.llorllale.cactoos.matchers.HasValues;
import org.llorllale.cactoos.matchers.Verifies;
/**
@@ -65,11 +65,7 @@ public boolean matchesSafely(final Collection col) {
new Assertion<>(
"Must contain item",
col,
- new IsCollectionContaining<>(
- new IsEqual<>(
- this.sample
- )
- )
+ new HasValues<>(this.sample)
).affirm();
new Assertion<>(
"Must not be empty",
@@ -90,18 +86,14 @@ public boolean matchesSafely(final Collection col) {
new ListOf<>(
(E[]) col.toArray()
),
- new IsCollectionContaining<>(
- new IsEqual<>(this.sample)
- )
+ new HasValues<>(this.sample)
).affirm();
final E[] array = (E[]) new Object[col.size()];
col.toArray(array);
new Assertion<>(
"Array from collection must contain item",
new ListOf<>(array),
- new IsCollectionContaining<>(
- new IsEqual<>(this.sample)
- )
+ new HasValues<>(this.sample)
).affirm();
new Assertion<>(
"Must contain list with the item",
diff --git a/src/test/java/org/cactoos/io/InputOfTest.java b/src/test/java/org/cactoos/io/InputOfTest.java
index 90b821aedf..aec06c9515 100644
--- a/src/test/java/org/cactoos/io/InputOfTest.java
+++ b/src/test/java/org/cactoos/io/InputOfTest.java
@@ -40,7 +40,6 @@
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.cactoos.bytes.BytesOf;
-import org.cactoos.iterable.IterableOf;
import org.cactoos.text.TextOf;
import org.hamcrest.core.AllOf;
import org.hamcrest.core.IsEqual;
@@ -180,10 +179,8 @@ void readsStringIntoBytes() throws Exception {
StandardCharsets.UTF_8
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith("Hello, "),
- new EndsWith("друг!")
- )
+ new StartsWith("Hello, "),
+ new EndsWith("друг!")
)
).affirm();
}
@@ -203,10 +200,8 @@ void readsStringBuilder() throws Exception {
)
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith(starts),
- new EndsWith(ends)
- )
+ new StartsWith(starts),
+ new EndsWith(ends)
)
).affirm();
}
@@ -226,10 +221,8 @@ void readsStringBuffer() throws Exception {
)
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith(starts),
- new EndsWith(ends)
- )
+ new StartsWith(starts),
+ new EndsWith(ends)
)
).affirm();
}
@@ -247,10 +240,8 @@ void readsArrayOfChars() throws Exception {
)
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith("Hold "),
- new EndsWith("infinity")
- )
+ new StartsWith("Hold "),
+ new EndsWith("infinity")
)
).affirm();
}
@@ -272,10 +263,8 @@ void readsEncodedArrayOfChars() throws Exception {
StandardCharsets.UTF_8
),
new AllOf<>(
- new IterableOf<>(
- new StartsWith("O que sera"),
- new EndsWith(" que sera")
- )
+ new StartsWith("O que sera"),
+ new EndsWith(" que sera")
)
).affirm();
}
diff --git a/src/test/java/org/cactoos/map/BehavesAsMap.java b/src/test/java/org/cactoos/map/BehavesAsMap.java
index 75ecb60eb5..d901f12cfe 100644
--- a/src/test/java/org/cactoos/map/BehavesAsMap.java
+++ b/src/test/java/org/cactoos/map/BehavesAsMap.java
@@ -25,11 +25,10 @@
import java.util.Map;
import org.hamcrest.Description;
-import org.hamcrest.MatcherAssert;
import org.hamcrest.TypeSafeMatcher;
-import org.hamcrest.collection.IsMapContaining;
-import org.hamcrest.core.IsCollectionContaining;
-import org.hamcrest.core.IsEqual;
+import org.llorllale.cactoos.matchers.Assertion;
+import org.llorllale.cactoos.matchers.HasEntry;
+import org.llorllale.cactoos.matchers.HasValues;
/**
* Matcher for collection.
@@ -62,25 +61,23 @@ public BehavesAsMap(final K akey, final V val) {
}
@Override
+ @SuppressWarnings("unchecked")
public boolean matchesSafely(final Map map) {
- MatcherAssert.assertThat(
- "Doesn't contain the key",
+ new Assertion<>(
+ "Must contain the key/value entry",
map,
- new IsMapContaining<>(
- new IsEqual<>(this.key),
- new IsEqual<>(this.value)
- )
- );
- MatcherAssert.assertThat(
- "Doesn't contain the key in #keySet()",
+ new HasEntry<>(this.key, this.value)
+ ).affirm();
+ new Assertion<>(
+ "Must contain the key in #keySet()",
map.keySet(),
- new IsCollectionContaining<>(new IsEqual<>(this.key))
- );
- MatcherAssert.assertThat(
- "Doesn't contain the value in #values()",
+ new HasValues<>(this.key)
+ ).affirm();
+ new Assertion<>(
+ "Must contain the value in #values()",
map.values(),
- new IsCollectionContaining<>(new IsEqual<>(this.value))
- );
+ new HasValues<>(this.value)
+ ).affirm();
return true;
}
diff --git a/src/test/java/org/cactoos/map/MapOfTest.java b/src/test/java/org/cactoos/map/MapOfTest.java
index d5986e637e..8f1ef0b131 100644
--- a/src/test/java/org/cactoos/map/MapOfTest.java
+++ b/src/test/java/org/cactoos/map/MapOfTest.java
@@ -29,7 +29,6 @@
import org.cactoos.func.FuncOf;
import org.cactoos.iterable.IterableOf;
import org.cactoos.scalar.Constant;
-import org.hamcrest.MatcherAssert;
import org.hamcrest.collection.IsMapContaining;
import org.hamcrest.core.AllOf;
import org.hamcrest.core.IsAnything;
@@ -37,6 +36,7 @@
import org.hamcrest.core.StringStartsWith;
import org.junit.jupiter.api.Test;
import org.llorllale.cactoos.matchers.Assertion;
+import org.llorllale.cactoos.matchers.HasEntry;
/**
* Test case for {@link MapOf}.
@@ -49,8 +49,8 @@ final class MapOfTest {
@Test
void behavesAsMap() {
- MatcherAssert.assertThat(
- "Can't behave as a map",
+ new Assertion<>(
+ "Must behave as a map",
new NoNulls<>(
new MapOf(
new MapEntry<>(0, -1),
@@ -58,13 +58,13 @@ void behavesAsMap() {
)
),
new BehavesAsMap<>(1, 1)
- );
+ ).affirm();
}
@Test
void convertsIterableToMap() {
- MatcherAssert.assertThat(
- "Can't convert iterable to map",
+ new Assertion<>(
+ "Must convert iterable to map",
new MapOf(
new MapEntry<>(0, "hello, "),
new MapEntry<>(1, "world!")
@@ -73,13 +73,13 @@ void convertsIterableToMap() {
new IsEqual<>(0),
new StringStartsWith("hello")
)
- );
+ ).affirm();
}
@Test
void createsMapWithFunctions() {
- MatcherAssert.assertThat(
- "Can't create a map with functions as values",
+ new Assertion<>(
+ "Must create a map with functions as values",
new MapOf>(
new MapEntry<>(0, () -> true),
new MapEntry<>(
@@ -90,25 +90,25 @@ void createsMapWithFunctions() {
)
),
new IsMapContaining<>(new IsEqual<>(0), new IsAnything<>())
- );
+ ).affirm();
}
@Test
void integersToString() {
- MatcherAssert.assertThat(
- "Can't convert map of integers to string",
+ new Assertion<>(
+ "Must convert map of integers to string",
new MapOf(
new MapEntry<>(-1, 0),
new MapEntry<>(1, 2)
).toString(),
new IsEqual<>("{-1=0, 1=2}")
- );
+ ).affirm();
}
@Test
void mapsToString() {
- MatcherAssert.assertThat(
- "Can't convert map op maps to string",
+ new Assertion<>(
+ "Must convert map op maps to string",
new MapOf>(
new MapEntry>(
-1,
@@ -126,36 +126,34 @@ void mapsToString() {
)
).toString(),
new IsEqual<>("{-1={4=7, first=second}, 1={green=red, 2.7=3.1}}")
- );
+ ).affirm();
}
@Test
void emptyToString() {
- MatcherAssert.assertThat(
+ new Assertion<>(
"Can't convert empty map to string",
new MapOf>().toString(),
new IsEqual<>("{}")
- );
+ ).affirm();
}
@Test
@SuppressWarnings("unchecked")
void createsMapFromMapAndMapEntries() {
- MatcherAssert.assertThat(
- "Can't create a map from map and map entries",
- new MapOf(
- new MapOf(
+ new Assertion>(
+ "Must create a map from map and map entries",
+ new MapOf<>(
+ new MapOf<>(
new MapEntry(0, 0)
),
new MapEntry(1, 1)
),
new AllOf<>(
- new IterableOf<>(
- new IsMapContaining<>(new IsEqual<>(0), new IsEqual<>(0)),
- new IsMapContaining<>(new IsEqual<>(1), new IsEqual<>(1))
- )
+ new HasEntry<>(0, 0),
+ new HasEntry<>(1, 1)
)
- );
+ ).affirm();
}
@Test
@@ -167,15 +165,15 @@ void createsMapFromFunctionsAndIterable() {
new FuncOf(new Constant<>(0)),
new IterableOf(0)
),
- new IsMapContaining<>(new IsEqual<>(0), new IsEqual<>(0))
+ new HasEntry<>(0, 0)
).affirm();
}
@Test
@SuppressWarnings("unchecked")
void createsMapFromMapFunctionsAndIterable() {
- new Assertion<>(
- "Can't create a map from map, functions and iterable.",
+ new Assertion>(
+ "Must create a map from map, functions and iterable.",
new MapOf(
new FuncOf(new Constant<>(0)),
new FuncOf(new Constant<>(0)),
@@ -185,10 +183,8 @@ void createsMapFromMapFunctionsAndIterable() {
new IterableOf<>(0)
),
new AllOf<>(
- new IterableOf<>(
- new IsMapContaining<>(new IsEqual<>(0), new IsEqual<>(0)),
- new IsMapContaining<>(new IsEqual<>(1), new IsEqual<>(1))
- )
+ new HasEntry<>(0, 0),
+ new HasEntry<>(1, 1)
)
).affirm();
}
diff --git a/src/test/java/org/cactoos/map/NoNullsTest.java b/src/test/java/org/cactoos/map/NoNullsTest.java
index 313a518c57..806c1c41f4 100644
--- a/src/test/java/org/cactoos/map/NoNullsTest.java
+++ b/src/test/java/org/cactoos/map/NoNullsTest.java
@@ -24,14 +24,16 @@
package org.cactoos.map;
import java.util.HashMap;
-import org.cactoos.iterable.IterableOf;
+import java.util.Map;
+import java.util.Set;
import org.hamcrest.MatcherAssert;
-import org.hamcrest.collection.IsMapContaining;
import org.hamcrest.core.AllOf;
import org.hamcrest.core.IsEqual;
+import org.hamcrest.core.IsIterableContaining;
import org.junit.Ignore;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
+import org.llorllale.cactoos.matchers.IsEntry;
import org.llorllale.cactoos.matchers.Throws;
/**
@@ -347,8 +349,8 @@ public void clear() {
@Test
@SuppressWarnings("unchecked")
public void entrySet() {
- MatcherAssert.assertThat(
- "Can't call #entrySet()",
+ new Assertion>>(
+ "Must call #entrySet()",
new NoNulls(
new HashMap() {
{
@@ -356,14 +358,12 @@ public void entrySet() {
put(0, 0);
}
}
- ),
+ ).entrySet(),
new AllOf<>(
- new IterableOf<>(
- new IsMapContaining<>(new IsEqual<>(1), new IsEqual<>(1)),
- new IsMapContaining<>(new IsEqual<>(0), new IsEqual<>(0))
- )
+ new IsIterableContaining<>(new IsEntry<>(1, 1)),
+ new IsIterableContaining<>(new IsEntry<>(0, 0))
)
- );
+ ).affirm();
}
@Test
diff --git a/src/test/java/org/cactoos/map/RemoveDeletesValues.java b/src/test/java/org/cactoos/map/RemoveDeletesValues.java
index 087b851a36..5f26429666 100644
--- a/src/test/java/org/cactoos/map/RemoveDeletesValues.java
+++ b/src/test/java/org/cactoos/map/RemoveDeletesValues.java
@@ -25,12 +25,12 @@
import java.util.Map;
import org.hamcrest.Description;
-import org.hamcrest.MatcherAssert;
import org.hamcrest.TypeSafeMatcher;
import org.hamcrest.collection.IsMapContaining;
-import org.hamcrest.core.IsCollectionContaining;
import org.hamcrest.core.IsEqual;
+import org.hamcrest.core.IsIterableContaining;
import org.hamcrest.core.IsNot;
+import org.llorllale.cactoos.matchers.Assertion;
/**
* Check a remove method.
@@ -66,8 +66,8 @@ public RemoveDeletesValues(final K akey, final V val) {
@Override
public boolean matchesSafely(final Map map) {
map.remove(this.key);
- MatcherAssert.assertThat(
- "Contains the key/value after remove",
+ new Assertion<>(
+ "Must not the key/value after remove",
map,
new IsNot<>(
new IsMapContaining<>(
@@ -75,21 +75,21 @@ public boolean matchesSafely(final Map map) {
new IsEqual<>(this.value)
)
)
- );
- MatcherAssert.assertThat(
- "Contains the key in #keySet() after remove",
+ ).affirm();
+ new Assertion<>(
+ "Must not the key in #keySet() after remove",
map.keySet(),
new IsNot<>(
- new IsCollectionContaining<>(new IsEqual<>(this.key))
+ new IsIterableContaining<>(new IsEqual<>(this.key))
)
- );
- MatcherAssert.assertThat(
- "Contains the value in #values() after remove",
+ ).affirm();
+ new Assertion<>(
+ "Must not the value in #values() after remove",
map.values(),
new IsNot<>(
- new IsCollectionContaining<>(new IsEqual<>(this.value))
+ new IsIterableContaining<>(new IsEqual<>(this.value))
)
- );
+ ).affirm();
return true;
}
diff --git a/src/test/java/org/cactoos/scalar/TernaryTest.java b/src/test/java/org/cactoos/scalar/TernaryTest.java
index b636d8c651..54251a5398 100644
--- a/src/test/java/org/cactoos/scalar/TernaryTest.java
+++ b/src/test/java/org/cactoos/scalar/TernaryTest.java
@@ -24,13 +24,14 @@
package org.cactoos.scalar;
import java.util.concurrent.atomic.AtomicInteger;
-import org.cactoos.iterable.IterableOf;
+import org.cactoos.Scalar;
+import org.cactoos.Text;
import org.cactoos.text.FormattedText;
-import org.cactoos.text.TextOf;
import org.hamcrest.core.AllOf;
import org.junit.jupiter.api.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.HasValue;
+import org.llorllale.cactoos.matchers.IsText;
/**
* Test case for {@link Ternary}.
@@ -124,7 +125,7 @@ void inputScalar() throws Exception {
@Test
@SuppressWarnings("unchecked")
void inputScalarValueConserved() throws Exception {
- new Assertion<>(
+ new Assertion>(
"Must conserve the same scalar value for each whole evaluation",
new Ternary<>(
new ScalarOf<>(new AtomicInteger(0)::incrementAndGet),
@@ -133,11 +134,9 @@ void inputScalarValueConserved() throws Exception {
i -> new FormattedText("else: %d", i)
),
new AllOf<>(
- new IterableOf<>(
- new HasValue<>(new TextOf("1 equals 1")),
- new HasValue<>(new TextOf("else: 2")),
- new HasValue<>(new TextOf("else: 3"))
- )
+ new HasValue<>(new IsText("1 equals 1")),
+ new HasValue<>(new IsText("else: 2")),
+ new HasValue<>(new IsText("else: 3"))
)
).affirm();
}
diff --git a/src/test/java/org/cactoos/set/SetOfTest.java b/src/test/java/org/cactoos/set/SetOfTest.java
index 44a7f12ba6..89be13bee4 100644
--- a/src/test/java/org/cactoos/set/SetOfTest.java
+++ b/src/test/java/org/cactoos/set/SetOfTest.java
@@ -23,77 +23,68 @@
*/
package org.cactoos.set;
+import org.cactoos.Text;
import org.cactoos.iterable.IterableOf;
import org.cactoos.iterable.Joined;
import org.cactoos.text.TextOf;
-import org.hamcrest.Matcher;
import org.hamcrest.core.AllOf;
-import org.hamcrest.core.IsCollectionContaining;
-import org.hamcrest.core.IsEqual;
import org.junit.jupiter.api.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.HasSize;
+import org.llorllale.cactoos.matchers.HasValues;
/**
* Test case for {@link SetOf}.
* @since 0.49.2
* @checkstyle MagicNumber (500 line)
- * @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
final class SetOfTest {
@Test
+ @SuppressWarnings("unchecked")
void behaveAsSetWithOriginalDuplicationsInTheTail() {
- new Assertion<>(
+ new Assertion>(
"Must keep unique integer numbers",
new SetOf<>(1, 2, 2),
new AllOf<>(
- new IterableOf>>(
- new HasSize(2),
- new IsCollectionContaining<>(new IsEqual<>(1)),
- new IsCollectionContaining<>(new IsEqual<>(2))
- )
+ new HasSize(2),
+ new HasValues<>(1, 2)
)
).affirm();
}
@Test
+ @SuppressWarnings("unchecked")
void behaveAsSetWithOriginalDuplicationsInTheHead() {
- new Assertion<>(
+ new Assertion>(
"Must keep unique integer numbers",
new SetOf<>(1, 1, 2, 3),
new AllOf<>(
- new IterableOf>>(
- new HasSize(3),
- new IsCollectionContaining<>(new IsEqual<>(1)),
- new IsCollectionContaining<>(new IsEqual<>(2)),
- new IsCollectionContaining<>(new IsEqual<>(3))
- )
+ new HasSize(3),
+ new HasValues<>(1, 2, 3)
)
).affirm();
}
@Test
+ @SuppressWarnings("unchecked")
void behaveAsSetWithOriginalDuplicationsInTheMiddle() {
- new Assertion<>(
+ new Assertion>(
"Must keep unique integer numbers",
new SetOf<>(1, 2, 2, 3),
new AllOf<>(
- new IterableOf>>(
- new HasSize(3),
- new IsCollectionContaining<>(new IsEqual<>(1)),
- new IsCollectionContaining<>(new IsEqual<>(2)),
- new IsCollectionContaining<>(new IsEqual<>(3))
- )
+ new HasSize(3),
+ new HasValues<>(1, 2, 3)
)
).affirm();
}
@Test
+ @SuppressWarnings("unchecked")
void behaveAsSetMergedCollectionsOfLiteralsWithDuplicates() {
- new Assertion<>(
+ new Assertion>(
"Must keep unique string literals",
new SetOf(
new Joined(
@@ -102,53 +93,42 @@ void behaveAsSetMergedCollectionsOfLiteralsWithDuplicates() {
)
),
new AllOf<>(
- new IterableOf>>(
- new HasSize(5),
- new IsCollectionContaining<>(new IsEqual<>("aa")),
- new IsCollectionContaining<>(new IsEqual<>("bb")),
- new IsCollectionContaining<>(new IsEqual<>("cc")),
- new IsCollectionContaining<>(new IsEqual<>("dd")),
- new IsCollectionContaining<>(new IsEqual<>("ff"))
- )
+ new HasSize(5),
+ new HasValues<>("aa", "bb", "cc", "dd", "ff")
)
).affirm();
}
@Test
+ @SuppressWarnings("unchecked")
void behaveAsSetWithOriginalDuplicationsOfCharsInTheMiddle() {
- new Assertion<>(
+ new Assertion>(
"Must keep unique characters",
new SetOf<>('a', 'b', 'b', 'c', 'a', 'b', 'd'),
new AllOf<>(
- new IterableOf>>(
- new HasSize(4),
- new IsCollectionContaining<>(new IsEqual<>('a')),
- new IsCollectionContaining<>(new IsEqual<>('b')),
- new IsCollectionContaining<>(new IsEqual<>('c')),
- new IsCollectionContaining<>(new IsEqual<>('d'))
- )
+ new HasSize(4),
+ new HasValues<>('a', 'b', 'c', 'd')
)
).affirm();
}
@Test
+ @SuppressWarnings("unchecked")
void behaveAsSetWithOriginalDuplicationsOfDoublesInTheMiddle() {
- new Assertion<>(
+ new Assertion>(
"Must keep unique double numbers",
new SetOf<>(1.5d, 2.4d, 1.5d, 2.4d, 2.4d, 1.5d),
new AllOf<>(
- new IterableOf>>(
- new HasSize(2),
- new IsCollectionContaining<>(new IsEqual<>(1.5d)),
- new IsCollectionContaining<>(new IsEqual<>(2.4d))
- )
+ new HasSize(2),
+ new HasValues<>(1.5d, 2.4d)
)
).affirm();
}
@Test
+ @SuppressWarnings("unchecked")
void behaveAsSetWithOriginalDuplicationsOfTextsInTheMiddle() {
- new Assertion<>(
+ new Assertion>(
"Must keep unique TextOf objects",
new SetOf<>(
new TextOf("12345"),
@@ -157,17 +137,11 @@ void behaveAsSetWithOriginalDuplicationsOfTextsInTheMiddle() {
new TextOf("00000")
),
new AllOf<>(
- new IterableOf>>(
- new HasSize(3),
- new IsCollectionContaining<>(
- new IsEqual<>(new TextOf("12345"))
- ),
- new IsCollectionContaining<>(
- new IsEqual<>(new TextOf("67890"))
- ),
- new IsCollectionContaining<>(
- new IsEqual<>(new TextOf("00000"))
- )
+ new HasSize(3),
+ new HasValues<>(
+ new TextOf("12345"),
+ new TextOf("67890"),
+ new TextOf("00000")
)
)
).affirm();
diff --git a/src/test/java/org/cactoos/text/AbbreviatedTest.java b/src/test/java/org/cactoos/text/AbbreviatedTest.java
index 3db7a1752a..884ef1bd8d 100644
--- a/src/test/java/org/cactoos/text/AbbreviatedTest.java
+++ b/src/test/java/org/cactoos/text/AbbreviatedTest.java
@@ -25,7 +25,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import org.cactoos.Text;
-import org.cactoos.iterable.IterableOf;
import org.hamcrest.core.AllOf;
import org.junit.jupiter.api.Test;
import org.llorllale.cactoos.matchers.Assertion;
@@ -146,13 +145,11 @@ void abbreviatesTextThatChanges() {
15
),
new AllOf<>(
- new IterableOf<>(
- new IsText(
- "The quick br..."
- ),
- new IsText(
- "The lazy bla..."
- )
+ new IsText(
+ "The quick br..."
+ ),
+ new IsText(
+ "The lazy bla..."
)
)
).affirm();