Skip to content

Commit

Permalink
(#1086) Remove UncheckedScalar and update cactoos-matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
victornoel committed Jun 17, 2019
1 parent a526feb commit fe264a4
Show file tree
Hide file tree
Showing 95 changed files with 477 additions and 456 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The MIT License (MIT)
<dependency>
<groupId>org.llorllale</groupId>
<artifactId>cactoos-matchers</artifactId>
<version>0.14</version>
<version>0.17</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
61 changes: 0 additions & 61 deletions src/main/java/org/cactoos/scalar/UncheckedScalar.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/java/org/cactoos/TextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void okForNoNulls() {
final String message = "Hello";
new Assertion<>(
"Must work with NoNulls",
() -> new NoNulls(
new NoNulls(
new TextOf(message)
),
new TextHasString(message)
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/cactoos/collection/BehavesAsCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public BehavesAsCollection(final E item) {
public boolean matchesSafely(final Collection<E> col) {
new Assertion<>(
"Must contain item",
() -> col,
col,
new IsCollectionContaining<>(
new IsEqual<>(
this.sample
Expand All @@ -73,21 +73,21 @@ public boolean matchesSafely(final Collection<E> col) {
).affirm();
new Assertion<>(
"Must not be empty",
() -> col,
col,
new IsNot<>(
new IsEmptyCollection<>()
)
).affirm();
new Assertion<>(
"Size must be more than 0",
() -> col,
col,
new IsCollectionWithSize<>(
new MatcherOf<>(s -> s > 0)
)
).affirm();
new Assertion<>(
"Array must contain item",
() -> new ListOf<>(
new ListOf<>(
(E[]) col.toArray()
),
new IsCollectionContaining<>(
Expand All @@ -98,14 +98,14 @@ public boolean matchesSafely(final Collection<E> col) {
col.toArray(array);
new Assertion<>(
"Array from collection must contain item",
() -> new ListOf<>(array),
new ListOf<>(array),
new IsCollectionContaining<>(
new IsEqual<>(this.sample)
)
).affirm();
new Assertion<>(
"Must contain list with the item",
() -> col.containsAll(
col.containsAll(
new ListOf<>(this.sample)
),
new IsEqual<>(true)
Expand Down
26 changes: 13 additions & 13 deletions src/test/java/org/cactoos/collection/CollectionEnvelopeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void returnsIteratorWithUnsupportedRemove() {
public void notEqualToObjectOfAnotherType() {
new Assertion<>(
"Collection is equal to object of different type",
() -> new CollectionOf<>(),
new CollectionOf<>(),
new IsNot<>(new IsEqual<>("a"))
).affirm();
}
Expand All @@ -70,7 +70,7 @@ public void notEqualToObjectOfAnotherType() {
public void notEqualToCollectionOfDifferentSize() {
new Assertion<>(
"Collection is equal to a collection of different size",
() -> new CollectionOf<>(),
new CollectionOf<>(),
new IsNot<>(new IsEqual<>(new CollectionOf<>("b")))
).affirm();
}
Expand All @@ -79,7 +79,7 @@ public void notEqualToCollectionOfDifferentSize() {
public void notEqualToCollectionOfDifferentElements() {
new Assertion<>(
"Collection is equal to a collection with different content",
() -> new CollectionOf<>("a", "b"),
new CollectionOf<>("a", "b"),
new IsNot<>(new IsEqual<>(new CollectionOf<>("a", "c")))
).affirm();
}
Expand All @@ -89,7 +89,7 @@ public void equalToItself() {
final CollectionOf<String> col = new CollectionOf<>("val1", "val2");
new Assertion<>(
"Collection is not equal to itself",
() -> col,
col,
new IsEqual<>(col)
).affirm();
}
Expand All @@ -98,7 +98,7 @@ public void equalToItself() {
public void equalToCollectionWithIdenticalContent() {
new Assertion<>(
"Collection is not equal to a collection with identical content",
() -> new CollectionOf<>("val1", "val2"),
new CollectionOf<>("val1", "val2"),
new IsEqual<>(new CollectionOf<>("val1", "val2"))
).affirm();
}
Expand All @@ -107,7 +107,7 @@ public void equalToCollectionWithIdenticalContent() {
public void equalToListWithIdenticalContent() {
new Assertion<>(
"Collection not equal to a list with identical content",
() -> new CollectionOf<>("a"),
new CollectionOf<>("a"),
new IsEqual<>(new ListOf<>("a"))
).affirm();
}
Expand All @@ -116,7 +116,7 @@ public void equalToListWithIdenticalContent() {
public void equalToDerivedCollection() {
new Assertion<>(
"Collection not equal to derived collection with identical content",
() -> new CollectionOf<>("a"),
new CollectionOf<>("a"),
new IsEqual<>(new CollectionEnvelopeTest.CustomCollection("a"))
).affirm();
}
Expand All @@ -125,7 +125,7 @@ public void equalToDerivedCollection() {
public void equalToEmptyCollection() {
new Assertion<>(
"Empty collection not equal with empty collection",
() -> new CollectionOf<>(),
new CollectionOf<>(),
new IsEqual<>(new CollectionOf<>())
).affirm();
}
Expand All @@ -134,7 +134,7 @@ public void equalToEmptyCollection() {
public void notEqualToNull() {
new Assertion<>(
"Empty collection equal to null",
() -> new CollectionOf<>(),
new CollectionOf<>(),
new IsNot<>(new IsEqual<>(null))
).affirm();
}
Expand All @@ -143,7 +143,7 @@ public void notEqualToNull() {
public void hashCodeEqual() {
new Assertion<>(
"HashCode returns different results for same entries",
() -> new CollectionOf<>("a", "b").hashCode(),
new CollectionOf<>("a", "b").hashCode(),
new IsEqual<>(new CollectionOf<>("a", "b").hashCode())
).affirm();
}
Expand All @@ -152,7 +152,7 @@ public void hashCodeEqual() {
public void differentHashCode() {
new Assertion<>(
"HashCode returns identical results for different entries",
() -> new CollectionOf<>("a", "b").hashCode(),
new CollectionOf<>("a", "b").hashCode(),
new IsNot<>(new IsEqual<>(new CollectionOf<>("b", "a").hashCode()))
).affirm();
}
Expand All @@ -163,7 +163,7 @@ public void emptyCollectionEnvelopeShouldBeEqualToEmptyCollection() {
final Collection<String> collection = Collections.emptyList();
new Assertion<>(
"Empty envelope and collection should be equal",
() -> envelope,
envelope,
new IsEqual<>(collection)
).affirm();
}
Expand All @@ -175,7 +175,7 @@ public void collectionEnvelopeShouldBeEqualToCollection() {
collection.add("a");
new Assertion<>(
"Envelope and collection should be equal",
() -> envelope,
envelope,
new IsEqual<>(collection)
).affirm();
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/org/cactoos/collection/CollectionOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class CollectionOfTest {
public void behavesAsCollection() {
new Assertion<>(
"Can't behave as a collection",
() -> new CollectionOf<>(1, 2, 0, -1),
new CollectionOf<>(1, 2, 0, -1),
new BehavesAsCollection<>(-1)
).affirm();
}
Expand All @@ -50,7 +50,7 @@ public void behavesAsCollection() {
public void buildsCollectionFromIterable() {
new Assertion<>(
"Can't build a collection from iterable",
() -> new CollectionOf<>(
new CollectionOf<>(
new ListOf<>(
new IterableOf<>(1, 2, 0, -1)
)
Expand All @@ -63,7 +63,7 @@ public void buildsCollectionFromIterable() {
public void testToString() {
new Assertion<>(
"Wrong toString output. Expected \"[1, 2, 0, -1]\".",
() -> new CollectionOf<>(
new CollectionOf<>(
new ListOf<>(1, 2, 0, -1)
).toString(),
new IsEqual<>("[1, 2, 0, -1]")
Expand All @@ -74,7 +74,7 @@ public void testToString() {
public void testToStringEmpty() {
new Assertion<>(
"Wrong toString output. Expected \"[]\".",
() -> new CollectionOf<>(new ListOf<>()).toString(),
new CollectionOf<>(new ListOf<>()).toString(),
new IsEqual<>("[]")
).affirm();
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/cactoos/collection/FilteredTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public final class FilteredTest {
public void behavesAsCollection() {
new Assertion<>(
"Can't behave as a collection",
() -> new Filtered<Integer>(i -> i < 2, 1, 2, 0, -1),
new Filtered<Integer>(i -> i < 2, 1, 2, 0, -1),
new BehavesAsCollection<>(-1)
).affirm();
}
Expand All @@ -54,7 +54,7 @@ public void behavesAsCollection() {
public void filterEmptyList() {
new Assertion<>(
"Filter must work on empty collection",
() -> new Filtered<String>(
new Filtered<String>(
input -> input.length() > 4,
new ListOf<>()
),
Expand All @@ -66,7 +66,7 @@ public void filterEmptyList() {
public void size() {
new Assertion<>(
"Size must be equal to number of items matching the filter",
() -> new Filtered<String>(
new Filtered<String>(
input -> input.length() >= 4,
new IterableOf<>("some", "text", "yes")
).size(),
Expand All @@ -78,7 +78,7 @@ public void size() {
public void withItemsNotEmpty() {
new Assertion<>(
"Must not be empty with items",
() -> new Filtered<String>(
new Filtered<String>(
input -> input.length() > 4,
new IterableOf<>("first", "second")
),
Expand All @@ -90,7 +90,7 @@ public void withItemsNotEmpty() {
public void withoutItemsIsEmpty() {
new Assertion<>(
"Must be empty without items",
() -> new Filtered<String>(
new Filtered<String>(
input -> input.length() > 16,
new IterableOf<>("third", "fourth")
),
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/cactoos/collection/HeadOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class HeadOfTest {
public void headCollection() {
new Assertion<>(
"Can't skip elements in iterable",
() -> new HeadOf<>(
new HeadOf<>(
3,
"one", "two", "three", "four"
),
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/cactoos/collection/JoinedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public final class JoinedTest {
public void behavesAsCollection() {
new Assertion<>(
"Can't behave as a collection",
() -> new Joined<Integer>(
new Joined<Integer>(
new IterableOf<>(1, -1, 2, 0),
new IterableOf<>(1, -1, 2, 0),
new IterableOf<>(1, -1, 2, 0)
Expand All @@ -61,7 +61,7 @@ public void behavesAsCollection() {
public void size() {
new Assertion<>(
"Must have correct size",
() -> new Joined<String>(
new Joined<String>(
new IterableOf<>("hello", "world", "друг"),
new IterableOf<>("how", "are", "you"),
new IterableOf<>("what's", "up")
Expand All @@ -74,7 +74,7 @@ public void size() {
public void sizeEmptyReturnZero() {
new Assertion<>(
"Size must be 0",
() -> new Joined<String>(
new Joined<String>(
Collections.emptyList()
),
new IsCollectionWithSize<>(new IsEqual<>(0))
Expand All @@ -85,7 +85,7 @@ public void sizeEmptyReturnZero() {
public void withItemsNotEmpty() {
new Assertion<>(
"Must be not empty",
() -> new Joined<String>(
new Joined<String>(
new IterableOf<>("1", "2"),
new IterableOf<>("3", "4")
),
Expand All @@ -97,7 +97,7 @@ public void withItemsNotEmpty() {
public void withoutItemsIsEmpty() {
new Assertion<>(
"Must be empty",
() -> new Joined<String>(
new Joined<String>(
Collections.emptyList()
),
new IsEmptyCollection<>()
Expand Down
Loading

2 comments on commit fe264a4

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on fe264a4 Jun 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 1081-f3313fb1 disappeared from src/main/java/org/cactoos/scalar/UncheckedScalar.java, that's why I closed #1086. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on fe264a4 Jun 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 1086-77b05812 discovered in src/test/java/org/cactoos/io/TeeInputHasResult.java and submitted as #1144. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.