Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Sep 4, 2020
2 parents d43ca98 + 05defe4 commit 02f7902
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 32 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ The MIT License (MIT)
<signaturesFile>./src/test/resources/forbidden-apis.txt</signaturesFile>
</signaturesFiles>
<!--
@todo #1166:30min In the continuation of #588, all the calls
@todo #1223:30min In the continuation of #588, all the calls
to Matchers should be replaced with their OO counterparts.
This todo should be updated with a new one until everything is
done. The newly covered classes should be added to the include
Expand All @@ -216,6 +216,7 @@ The MIT License (MIT)
<include>org/cactoos/time/*.class</include>
<include>org/cactoos/collection/*.class</include>
<include>org/cactoos/experimental/*.class</include>
<include>org/cactoos/func/*.class</include>
</includes>
</configuration>
<executions>
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/org/cactoos/func/ProcOfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import java.util.List;
import java.util.concurrent.Callable;
import org.cactoos.text.FormattedText;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.HasValues;

/**
* Test case for {@link ProcOf}.
Expand Down Expand Up @@ -57,7 +57,7 @@ public void run() {
str
).asString(),
list,
Matchers.contains(str)
new HasValues<>(str)
).affirm();
}

Expand All @@ -80,7 +80,7 @@ public String call() throws Exception {
str
).asString(),
list,
Matchers.contains(str)
new HasValues<>(str)
).affirm();
}

Expand All @@ -100,7 +100,7 @@ public void worksWithFunc() throws Exception {
str
).asString(),
list,
Matchers.contains(str)
new HasValues<>(str)
).affirm();
}
}
7 changes: 4 additions & 3 deletions src/test/java/org/cactoos/func/RepeatedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import java.util.Iterator;
import org.cactoos.Func;
import org.cactoos.iterator.IteratorOf;
import org.hamcrest.Matchers;
import org.hamcrest.core.IsEqual;
import org.hamcrest.core.IsNull;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.Throws;
Expand All @@ -51,7 +52,7 @@ public void runsFuncMultipleTimes() throws Exception {
new Assertion<>(
"Must be applied 3 times",
func.apply(true),
Matchers.equalTo(5)
new IsEqual<>(5)
).affirm();
}

Expand All @@ -64,7 +65,7 @@ public void repeatsNullsResults() throws Exception {
new Assertion<>(
"Must repeat NULL",
func.apply(true),
Matchers.equalTo(null)
new IsNull<>()
).affirm();
}

Expand Down
11 changes: 8 additions & 3 deletions src/test/java/org/cactoos/func/SolidBiFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import java.security.SecureRandom;
import org.cactoos.BiFunc;
import org.cactoos.Func;
import org.hamcrest.Matchers;
import org.hamcrest.core.IsEqual;
import org.hamcrest.core.IsNot;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.RunsInThreads;
Expand Down Expand Up @@ -60,7 +61,7 @@ public void testThatFuncIsSynchronized() {
new Assertion<>(
"Shared resource has been modified by multiple threads.",
shared[0],
Matchers.is(1)
new IsEqual<>(1)
).affirm();
}

Expand All @@ -74,7 +75,11 @@ public void testThatFuncResultCacheIsLimited() throws Exception {
new Assertion<>(
"Result of (0, 0) call wasn't invalidated.",
func.apply(0, 0) + func.apply(1, 1),
Matchers.not(func.apply(1, 1) + func.apply(0, 0))
new IsNot<>(
new IsEqual<>(
func.apply(1, 1) + func.apply(0, 0)
)
)
).affirm();
}
}
6 changes: 3 additions & 3 deletions src/test/java/org/cactoos/func/SolidFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.security.SecureRandom;
import org.cactoos.Func;
import org.cactoos.list.ListOf;
import org.hamcrest.Matchers;
import org.hamcrest.core.IsEqual;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.RunsInThreads;
Expand All @@ -47,7 +47,7 @@ public void cachesFuncResults() throws Exception {
new Assertion<>(
"Must cache results",
func.apply(true) + func.apply(true),
Matchers.equalTo(func.apply(true) + func.apply(true))
new IsEqual<>(func.apply(true) + func.apply(true))
).affirm();
}

Expand All @@ -59,7 +59,7 @@ public void worksInThreads() {
new Assertion<>(
"Result must be cached",
func.apply(true),
Matchers.equalTo(func.apply(true))
new IsEqual<>(func.apply(true))
).affirm();
return true;
},
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/cactoos/func/StickyBiFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import java.security.SecureRandom;
import org.cactoos.BiFunc;
import org.hamcrest.Matchers;
import org.hamcrest.core.IsEqual;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;

Expand All @@ -44,7 +44,7 @@ public void cachesFuncResults() throws Exception {
new Assertion<>(
"Must cache results",
func.apply(true, true) + func.apply(true, true),
Matchers.equalTo(func.apply(true, true) + func.apply(true, true))
new IsEqual<>(func.apply(true, true) + func.apply(true, true))
).affirm();
}

Expand Down
15 changes: 10 additions & 5 deletions src/test/java/org/cactoos/func/StickyFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

import java.security.SecureRandom;
import org.cactoos.Func;
import org.hamcrest.Matchers;
import org.hamcrest.core.IsEqual;
import org.hamcrest.core.IsNot;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;

Expand All @@ -45,7 +46,7 @@ public void cachesFuncResults() throws Exception {
new Assertion<>(
"Must cache results",
func.apply(true) + func.apply(true),
Matchers.equalTo(
new IsEqual<>(
func.apply(true) + func.apply(true)
)
).affirm();
Expand All @@ -61,13 +62,13 @@ public void cachesWithLimitedBuffer() throws Exception {
new Assertion<>(
"Must cache two results",
first + second,
Matchers.equalTo(func.apply(0) + func.apply(1))
new IsEqual<>(func.apply(0) + func.apply(1))
).affirm();
final int third = func.apply(-1);
new Assertion<>(
"Must cache next two results",
second + third,
Matchers.equalTo(func.apply(1) + func.apply(-1))
new IsEqual<>(func.apply(1) + func.apply(-1))
).affirm();
}

Expand All @@ -79,7 +80,11 @@ public void cachesWithZeroBuffer() throws Exception {
new Assertion<>(
"Must be not be cached",
func.apply(true) + func.apply(true),
Matchers.not(Matchers.equalTo(func.apply(true) + func.apply(true)))
new IsNot<>(
new IsEqual<>(
func.apply(true) + func.apply(true)
)
)
).affirm();
}

Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/cactoos/func/SyncFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import java.util.LinkedList;
import java.util.List;
import org.hamcrest.Matchers;
import org.hamcrest.core.IsEqual;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.RunsInThreads;
Expand Down Expand Up @@ -56,7 +56,7 @@ public void funcWorksInThreads() {
new Assertion<>(
"Must run the expected amount of threads",
list.size(),
Matchers.equalTo(threads)
new IsEqual<>(threads)
).affirm();
}

Expand All @@ -80,7 +80,7 @@ public void procWorksInThreads() {
new Assertion<>(
"Must run the expected amount of threads",
counter[0],
Matchers.equalTo(threads)
new IsEqual<>(threads)
).affirm();
}

Expand All @@ -104,7 +104,7 @@ public void callableWorksInThreads() {
new Assertion<>(
"Must run the expected amount of threads",
counter[0],
Matchers.equalTo(threads)
new IsEqual<>(threads)
).affirm();
}

Expand All @@ -126,7 +126,7 @@ public void runnableWorksInThreads() {
new Assertion<>(
"Must run the expected amount of threads",
counter[0],
Matchers.equalTo(threads)
new IsEqual<>(threads)
).affirm();
}
}
7 changes: 3 additions & 4 deletions src/test/java/org/cactoos/func/TimedFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import java.util.concurrent.TimeoutException;
import org.cactoos.iterable.Endless;
import org.cactoos.scalar.And;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.IsTrue;

/**
* Test case for {@link Timed}.
Expand Down Expand Up @@ -74,7 +74,7 @@ public void futureTaskIsCancelled() {
new Assertion<>(
"Must be canceled after 1 sec",
future.isCancelled(),
Matchers.equalTo(true)
new IsTrue()
).affirm();
}
}
Expand All @@ -88,8 +88,7 @@ public void functionIsExecuted() throws Exception {
input -> true,
period
).apply(true),
Matchers.equalTo(true)
new IsTrue()
).affirm();
}
}

4 changes: 2 additions & 2 deletions src/test/java/org/cactoos/func/UncheckedBiFuncTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

import java.io.IOException;
import java.io.UncheckedIOException;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.llorllale.cactoos.matchers.Assertion;
import org.llorllale.cactoos.matchers.IsTrue;

/**
* Test case for {@link UncheckedBiFunc}.
Expand All @@ -52,7 +52,7 @@ public void testUncheckedBiFunc() {
new UncheckedBiFunc<>(
(fst, scd) -> true
).apply(1, 2),
Matchers.equalTo(true)
new IsTrue()
).affirm();
}

Expand Down

3 comments on commit 02f7902

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 02f7902 Sep 4, 2020

Choose a reason for hiding this comment

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

Puzzle 1166-fd48e847 disappeared from pom.xml, that's why I closed #1223. 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 02f7902 Sep 4, 2020

Choose a reason for hiding this comment

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

Puzzle 1392-4d58016d disappeared from src/test/java/org/cactoos/io/TeeInputFromInputTest.java, that's why I closed #1395. 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 02f7902 Sep 4, 2020

Choose a reason for hiding this comment

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

Puzzle 1223-fd48e847 discovered in pom.xml and submitted as #1434. 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.