Skip to content
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

#42: Added 'Condition' and wrote a few tests for AssertRequest #48

Merged
merged 3 commits into from
Mar 14, 2018

Conversation

llorllale
Copy link
Contributor

This PR:

* Added new 'Condition' class to support our tests
* AssertRequest now accepts Condition instead of Predicate<HttpRequest>
@coveralls
Copy link

coveralls commented Mar 14, 2018

Pull Request Test Coverage Report for Build 69

  • 0 of 0 (NaN%) changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 53.75%

Totals Coverage Status
Change from base Build 66: 0.0%
Covered Lines: 43
Relevant Lines: 80

💛 - Coveralls

Copy link
Owner

@amihaiemil amihaiemil left a comment

Choose a reason for hiding this comment

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

@llorllale Looks good, just a few comments

*/
public Predicate<HttpRequest> test() {
return this.test;
}
Copy link
Owner

Choose a reason for hiding this comment

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

@llorllale This method could be changed a little, like this:

public void test(final HttpRequest request) {
    if(!this.predicate.test(request)){
        Assert.fail(this.msg);
    };
}

Then you could also get rid of the msg() accessor and also refactor method check from AssertRequest, it could simply be:

private void check(final HttpRequest request) {
    this.conditions.forEach(cond -> {cond.test(request)});
}

I know you said you didn't want a lot of design into this support class, but it's too good not to do it :D
You can also leave a puzzle for it and I'll do it later, if you spent all the time already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/**
* The test that the http request must satisfy.
*/
private final Predicate<HttpRequest> test;
Copy link
Owner

Choose a reason for hiding this comment

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

@llorllale Can you rename this to predicate or something else? Too much test around :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/**
* Tests for {@link AssertRequest}.
*
* @author George Aristy (george.aristy@gmail.com)
Copy link
Owner

Choose a reason for hiding this comment

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

@llorllale Don't forget the @since 0.0.1, and @version $Id$ here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per PR review:
* Inversion of control: the condition class itself now performs the
  actual test
As per PR review:
* Added missing javadoc tags
* Renamed an instance variable to avoid name clashing
@llorllale
Copy link
Contributor Author

@amihaiemil please check now

@amihaiemil
Copy link
Owner

@llorllale looks nice, thanks!

@amihaiemil
Copy link
Owner

@rultor merge it

@rultor
Copy link
Collaborator

rultor commented Mar 14, 2018

@rultor merge it

@amihaiemil OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 81773b8 into amihaiemil:master Mar 14, 2018
@rultor
Copy link
Collaborator

rultor commented Mar 14, 2018

@rultor merge it

@amihaiemil Done! FYI, the full log is here (took me 2min)

@0crat
Copy link
Collaborator

0crat commented Mar 15, 2018

@amihaiemil/z please, pay attention to this pull request

@0crat
Copy link
Collaborator

0crat commented Mar 15, 2018

Job #48 is now in scope, role is REV

@llorllale llorllale deleted the 42 branch March 15, 2018 14:03
@0crat
Copy link
Collaborator

0crat commented Mar 24, 2018

The job #48 is now out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants