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

#865 Added RqFromTest and HttpServletRequestFake #941

Merged
merged 4 commits into from
Jan 24, 2019

Conversation

fabriciofx
Copy link
Contributor

As per #865. Created:

  • RqFromTest
  • HttpServletRequestFake and ServletInputStreamOf to support it
  • HttpServletResquetFakTest

@0crat 0crat added the scope label Jan 12, 2019
@0crat
Copy link
Collaborator

0crat commented Jan 12, 2019

Job #941 is now in scope, role is REV

@0crat
Copy link
Collaborator

0crat commented Jan 12, 2019

This pull request #941 is assigned to @marceloamadeu/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @paulodamaso/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

@codecov-io
Copy link

codecov-io commented Jan 12, 2019

Codecov Report

Merging #941 into master will decrease coverage by 1.81%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #941      +/-   ##
============================================
- Coverage      74.1%   72.29%   -1.82%     
  Complexity      971      971              
============================================
  Files           222      224       +2     
  Lines          4785     4905     +120     
  Branches        361      364       +3     
============================================
  Hits           3546     3546              
- Misses         1089     1209     +120     
  Partials        150      150
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/takes/servlet/SrvTake.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...n/java/org/takes/servlet/ServletInputStreamOf.java 0% <0%> (ø) 0 <0> (?)
src/main/java/org/takes/servlet/RqFrom.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...java/org/takes/servlet/HttpServletRequestFake.java 0% <0%> (ø) 0 <0> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d5f747d...afd95b0. Read the comment docs.

@fabriciofx
Copy link
Contributor Author

@marceloamadeu ping

@fabriciofx
Copy link
Contributor Author

fabriciofx commented Jan 18, 2019

@marceloamadeu can I help you with anything?

@fabriciofx
Copy link
Contributor Author

@marceloamadeu ping

1 similar comment
@fabriciofx
Copy link
Contributor Author

@marceloamadeu ping

Copy link
Contributor

@marceloamadeu marceloamadeu left a comment

Choose a reason for hiding this comment

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

@fabriciofx Please take a look at the comment.

)
)
).printBody(),
Matchers.containsString(content)
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Why use static matcher? I suggest using org.hamcrest.core.StringContains

MatcherAssert.assertThat(
"Can't get the request method",
new HttpServletRequestFake(new RqFake()).getMethod(),
Matchers.equalTo("GET")
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx I also suggest using new IsEqual <> ("GET") instead of
Matchers.equalTo ("GET")

)
)
).printHead(),
Matchers.startsWith(
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx It is possible to replace org.hamcrest.core.StringStartsWith?

)
).printHead(),
Matchers.startsWith(
Joiner.on("\r\n").join(
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx
Copy link
Contributor Author

@marceloamadeu Please, can you check out again?

@marceloamadeu
Copy link
Contributor

@fabriciofx Tks!!!

@marceloamadeu
Copy link
Contributor

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Jan 23, 2019

@rultor merge

@marceloamadeu Thanks for your request. @paulodamaso Please confirm this.

Copy link
Contributor

@paulodamaso paulodamaso left a comment

Choose a reason for hiding this comment

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

@fabriciofx Thank for the PR, take a look at the comments please

final String header = names.nextElement();
head.add(
head.add(new HttpHead(this.sreq).toString());
final Collection<String> names = Collections.list(
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Let's use something from cactoos here, I think that ListOf should do the trick.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@paulodamaso Unfortunately, ListOf doesn't work with Enumeration therefore I must use Collections.list. Ah, I've opened a issue into cactoos project to create a new constructor to ListOf to support Enumeration but it was denied (because is too old).

Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx I've seen the issue in cactoos... Well, as they decided to not support Enumeration we should let it as is then, thanks.

)
).getHeaders("testheader")
),
Matchers.hasItems("someValue")
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Avoid using static matchers, use IsCollectionContaining or something similar 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.

@paulodamaso IsCollectionContaining usage is something like: IsCollectionContaining.hasItems("bla"). I think just the same, but if you want, I can change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx No, I'm talking about new IsIteratorContaining(Macther) form, avoiding the static method usage.

public void headerNames() {
MatcherAssert.assertThat(
"Can't get the header names",
Collections.list(
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Same comment as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@paulodamaso Same above too. The method returns an Enumeration and ListOf doesn't support it.

)
).getHeaderNames()
),
Matchers.hasItems("host", "anyheader", "crazyheader")
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Same comment about IsCollectionContaining

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabriciofx Same above.

MatcherAssert.assertThat(
"Can't get the request method",
new HttpServletRequestFake(new RqFake()).getMethod(),
new IsEqual<>("GET")
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Please use RqMethod.GET instead of "GET" 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.

@paulodamaso Done.

* @since 1.15
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx I think that you could create constants for the repeated values in this test and avoid using this supression WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@paulodamaso Can I use the same constant to all tests? It will works only in this case...

Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Or you could use final variables inside your test methods, for example, 'final String get = "GET /a-test"' and final String foo = "foo: bar" for header() and use this variables in the test. You don't need to use constants because values are not shared between the tests.

Copy link
Contributor

@paulodamaso paulodamaso left a comment

Choose a reason for hiding this comment

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

@fabriciofx Take a look at the comments, please. Also, I've noticed that the test methods signatures don't follow what explained in https://www.yegor256.com/2014/04/27/typical-mistakes-in-java-code.html#test-method-names , please fix them

)
).getHeaders("testheader")
),
Matchers.hasItems("someValue")
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx No, I'm talking about new IsIteratorContaining(Macther) form, avoiding the static method usage.

* @since 1.15
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Or you could use final variables inside your test methods, for example, 'final String get = "GET /a-test"' and final String foo = "foo: bar" for header() and use this variables in the test. You don't need to use constants because values are not shared between the tests.

@fabriciofx
Copy link
Contributor Author

fabriciofx commented Jan 24, 2019

@paulodamaso Done. Please, check it again. And, if it's ok, merge it!

Copy link
Contributor

@paulodamaso paulodamaso left a comment

Choose a reason for hiding this comment

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

@fabriciofx Just one more comment, please

import javax.servlet.ServletInputStream;

/**
* ServletInputStreamOf.
Copy link
Contributor

Choose a reason for hiding this comment

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

@fabriciofx Please enrich this javadoc so we can know what this class is about.

@fabriciofx
Copy link
Contributor Author

@paulodamaso Done. Please, check out.

@paulodamaso
Copy link
Contributor

@fabriciofx Thanks!

@paulodamaso
Copy link
Contributor

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Jan 24, 2019

@rultor merge

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

@rultor rultor merged commit afd95b0 into yegor256:master Jan 24, 2019
@rultor
Copy link
Collaborator

rultor commented Jan 24, 2019

@rultor merge

@paulodamaso Done! FYI, the full log is here (took me 20min)

@0crat
Copy link
Collaborator

0crat commented Jan 24, 2019

@ypshenychka/z please review this job completed by @marceloamadeu/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@0crat 0crat removed the scope label Jan 24, 2019
@0crat
Copy link
Collaborator

0crat commented Jan 24, 2019

Code review was too long (12 days), architects (@paulodamaso) were penalized, see §55

@0crat
Copy link
Collaborator

0crat commented Jan 24, 2019

The job #941 is now out of scope

@0crat
Copy link
Collaborator

0crat commented Jan 24, 2019

Payment to ARC for a closed pull request, as in §28: +10 point(s) just awarded to @paulodamaso/z

@ypshenychka
Copy link

@marceloamadeu According to our QA Rules:

Messages in a job always start with a name of a user they are addressed to.

Please correct your code review comments by indicating an addressee in the beginning.

@marceloamadeu
Copy link
Contributor

@ypshenychka Adjusted.

@marceloamadeu
Copy link
Contributor

@ypshenychka ping

@ypshenychka
Copy link

@marceloamadeu thanks

@ypshenychka
Copy link

@0crat quality acceptable

@0crat
Copy link
Collaborator

0crat commented Jan 26, 2019

@0crat quality acceptable (here)

@ypshenychka The project doesn't have enough funds, can't make a payment

@0crat
Copy link
Collaborator

0crat commented Jan 26, 2019

Order was finished, quality is "acceptable": +15 point(s) just awarded to @marceloamadeu/z

@0crat
Copy link
Collaborator

0crat commented Jan 26, 2019

Quality review completed: +8 point(s) just awarded to @ypshenychka/z

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

8 participants