-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(#1082) Replace forbidden API calls #1114
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1114 +/- ##
=========================================
Coverage 88.77% 88.77%
Complexity 1588 1588
=========================================
Files 275 275
Lines 3946 3946
Branches 214 214
=========================================
Hits 3503 3503
Misses 390 390
Partials 53 53 Continue to review full report at Codecov.
|
Job #1114 is now in scope, role is |
This pull request #1114 is assigned to @ilyakharlamov/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @llorllale/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer; there will be no monetary reward for this job |
@@ -62,26 +62,52 @@ public BehavesAsCollection(final E item) { | |||
@SuppressWarnings({ "unchecked", "PMD.ClassCastExceptionWithToArray" }) | |||
public boolean matchesSafely(final Collection<E> col) { | |||
MatcherAssert.assertThat( | |||
col, new IsCollectionContaining<>(new IsEqual<>(this.sample)) | |||
"Must contain item", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though MatcherAssert.assertThat
is still used, we are in transition to OO/Junit5 new Assertion
for all the new code added.
Please use new Assertion<>().affirm()
@@ -54,6 +54,7 @@ public void behavesAsCollection() throws Exception { | |||
@Test | |||
public void filterList() { | |||
MatcherAssert.assertThat( | |||
"Length must change", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Assertion<>().affirm()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah message should be "length equal to number of items matching filter"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah actually I don't understand what the difference is between this test and the size()
test below. I think this one can be deleted
@@ -79,6 +83,7 @@ public void decoratesArray() throws Exception { | |||
@Test | |||
public void testEmpty() { | |||
MatcherAssert.assertThat( | |||
"Must be empty", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Assertion<>().affirm()
Matchers.contains( | ||
"three", | ||
"four" | ||
new IsCollectionContaining<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throws Exception
is not needed here
@ilyakharlamov I replaced all MatcherAssert.assertThat with new Assertion<>().affirm() and removed throws Exception where it is not needed, please check |
@llorllale it's good to merge |
"two", | ||
"three" | ||
new IsCollectionContaining<>( | ||
new AnyOf<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Umbrah are you sure the logic is preserved here? Why not use AllOf
?
new Assertion<>( | ||
"Must contain item", | ||
() -> col, | ||
new IsCollectionContaining<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah can't you use HasValues
?
new Assertion<>( | ||
"Size must be more than 0", | ||
() -> col, | ||
new IsCollectionWithSize<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah HasSize
() -> new ListOf<>( | ||
(E[]) col.toArray() | ||
), | ||
new IsCollectionContaining<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah HasValues
new Assertion<>( | ||
"Array from collection must contain item", | ||
() -> new ListOf<>(array), | ||
new IsCollectionContaining<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah HasValues
new Filtered<String>( | ||
public void size() { | ||
new Assertion<>( | ||
"Size must change", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah message must be "size is equal to number of items matching the filter"
Matchers.arrayContaining(4, 3, 2, 1) | ||
); | ||
new IsArrayContaining<>( | ||
new AnyOf<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah AllOf
?
Matchers.arrayContaining(5, 4, 3, 2, 1) | ||
); | ||
new IsArrayContaining<>( | ||
new AnyOf<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah AllOf
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Umbrah better yet, HasValues
Matchers.contains( | ||
"three", | ||
"four" | ||
new IsCollectionContaining<>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@umbrah HasValues
@umbrah see above. Basically I worry that the logic may not have translated correctly into the new refactored code. Also, take a look at the available matchers from |
@llorllale The logic was incorrect, I updated all usages of IsCollectionContaining<>(AnyOf<>(...)) with AllOf<>(IsCollectionContaining<>(...)). I cannot use HasValues and HasSize as we do not have it in last published version of cactoos-matchers. Please check. |
@rultor merge |
@llorllale OK, I'll try to merge now. You can check the progress of the merge here |
@llorllale Done! FYI, the full log is here (took me 18min) |
Job was finished in 35 hours, bonus for fast delivery is possible (see §36) |
@sereshqua/z please review this job completed by @ilyakharlamov/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed |
Job #1114 is not in the agenda of @ilyakharlamov/z, can't inspect |
The job #1114 is now out of scope |
Payment to |
@0crat quality good |
Order was finished, quality is "good": +25 point(s) just awarded to @ilyakharlamov/z |
Quality review completed: +4 point(s) just awarded to @sereshqua/z |
This is for #1082
I replaced forbidden API calls in org.cactoos.collection package, updated to-do.