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

#631: TeeInput test class is incomplete #698

Merged
merged 6 commits into from
Feb 28, 2018
Merged

#631: TeeInput test class is incomplete #698

merged 6 commits into from
Feb 28, 2018

Conversation

proshin-roman
Copy link
Contributor

@proshin-roman proshin-roman commented Feb 20, 2018

Pull request for the issue #631.
Started adding tests for TeeInput's ctors. Added test cases for ctors which use Byte and ByteArray as inputs and left puzzles for continuing implementing tests.

@0crat 0crat added the scope label Feb 20, 2018
@0crat
Copy link
Collaborator

0crat commented Feb 20, 2018

Job #698 is now in scope, role is REV

@0crat
Copy link
Collaborator

0crat commented Feb 20, 2018

This pull request #698 is assigned to @amihaiemil/z, here is why. The budget is 15 minutes, see §4. Please, read §27 and when you decide to accept the changes, inform @yegor256/z (the architect) right in this ticket. If you decide that this PR should not be accepted ever, also inform the architect.

@codecov-io
Copy link

codecov-io commented Feb 20, 2018

Codecov Report

Merging #698 into master will increase coverage by 3.49%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #698      +/-   ##
============================================
+ Coverage     70.81%   74.31%   +3.49%     
- Complexity     1035     1101      +66     
============================================
  Files           221      222       +1     
  Lines          3348     3364      +16     
  Branches        190      190              
============================================
+ Hits           2371     2500     +129     
+ Misses          930      818     -112     
+ Partials         47       46       -1
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/cactoos/io/TeeInput.java 13.51% <ø> (+6.75%) 9 <0> (+5) ⬆️
src/main/java/org/cactoos/io/LengthOf.java 100% <0%> (ø) 6% <0%> (+1%) ⬆️
...ava/org/cactoos/collection/CollectionEnvelope.java 100% <0%> (ø) 15% <0%> (+1%) ⬆️
src/main/java/org/cactoos/scalar/HighestOf.java 100% <0%> (ø) 7% <0%> (?)
src/main/java/org/cactoos/text/TextOf.java 67.16% <0%> (+2.98%) 23% <0%> (+1%) ⬆️
src/main/java/org/cactoos/io/BytesOf.java 85.5% <0%> (+8.69%) 26% <0%> (+3%) ⬆️
src/main/java/org/cactoos/io/InputOf.java 80% <0%> (+16.66%) 26% <0%> (+5%) ⬆️
src/main/java/org/cactoos/func/CallableOf.java 100% <0%> (+18.18%) 5% <0%> (+1%) ⬆️
src/main/java/org/cactoos/map/SolidMap.java 70.83% <0%> (+33.33%) 9% <0%> (+4%) ⬆️
... and 3 more

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 29819e4...0e7628a. Read the comment docs.

Copy link

@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.

@proshin-roman This PR is too big and too raw. Splitting into PartA and PartB test classes doesn't feel OK.

Then, there are too many tests in one class, hard to find where an issue might be.

I also think you copy-pasted most of them and just changed some stuff -- since the PR is so big, it is very hard to review it and if there is a bug in one of them, boom, we have 1k tests with same bug.

See my comment, I think we should split these tests on categories.

Besides, don't forget about PDD, you clearly spent more than 30min on this task... the model will never ever repay you for overtime, keep that in mind!

Create a Test class for a category of tests (e.g. from Uri to ...), we will review that and you can create a puzzle for someone else to continue implementation of tests.

"Hello, товарищ äÄ üÜ öÖ and ß";

@Test
public void copiesFromUrlToPath() throws IOException {
Copy link

@amihaiemil amihaiemil Feb 21, 2018

Choose a reason for hiding this comment

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

@proshin-roman We have to create multiple test classes, since there are so many tests. An idea would be to create test classes based on the source of the TeeInput. E.g. TeeInputFromUriTestCase, TeeInputFromPathTestCase etc and each of these test files would contain tests for TeeInput from Uri to everything else, from Path to everything else etc.


@Test
public void copiesFromUrlToOutput() throws IOException {
final Path input = Files.createTempFile("input", ".txt");

Choose a reason for hiding this comment

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

@proshin-roman I think these temp files will automatically be deleted when the test is over or when the test fails/throws an exception, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amihaiemil No, these files are not deleted automatically. Method deleteOnExit has to be called to enable automatic deletion on JVM shutdown (more info here). Nevertheless, I found that no tests in Cactoos care about this problem, so all temp files stay forever in OS temp directory (until it's cleared by the OS itself). I will report a bug about this problem as it has to be fixed in many tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@amihaiemil I've submitted #702

@proshin-roman
Copy link
Contributor Author

@amihaiemil I've added two puzzles about splitting test classes on small ones based on a source of the TeeInput. In the rest, I think this pull request fixes the original bug - low test coverage - and current test coverage is 100% for TeeInput. I'd suggest to approve this pull request and then splitting of the test classes will be done in two new tickets.

@amihaiemil
Copy link

amihaiemil commented Feb 21, 2018

@proshin-roman no, I am still not happy, sorry. I mean, puzzles and the concept of PDD is for continuing work on a certain topic, not fixing the quality of the previous puzzle. See the difference between the 2 concepts?

If we merge this with those puzzles then we're basically saying: "hey, we wrote this pile of unit tests, please cleanup the mess and group the them" -- that's not how it works, each task has to be solved with a quality as high as possible.

This PR has poor quality because it's simply too big, countless tests (I couldn't even count them) with no grouping etc. I haven't even reviewed them all, can't even guarantee that they are decoupled haha.

So please, chose a group of tests, make a class for them and leave a single puzzle for continuing with other test classes.

@amihaiemil
Copy link

@proshin-roman or if you want, since you wrote them already, you could make more PRs with each group. This is up to you to decide.

@amihaiemil
Copy link

@proshin-roman and by the way, the convention in Yegor's projects is to name the branch as the ticket number it solves. Your branch is now names bugfix-631 - it could simply be named 631... it's not a problem, I don't think it's a rule, I'm just letting you know so you don't have to struggle and find names for the branches :)

@amihaiemil
Copy link

@proshin-roman ping; any status here? :)

@proshin-roman
Copy link
Contributor Author

@amihaiemil thanks for your attention :) I'm gonna post a fixed version this evening

@proshin-roman
Copy link
Contributor Author

@amihaiemil Pull request has been updated. I've fixed all comments. Please review it again.

Copy link

@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.

@proshin-roman Too big again. Too much stuff. Please, see my comments. I could not review those 2 test classes yet (the first 2 test classes that I said I would accept), since I have no idea how that new matcher works.

Please, follow the methodology; be fast, efficient (even greedy if you must), don't spend too much on it. You spent on this what, 1 day and a half? Too much. Even if I accept this PR you only get paid 30min.

Small PRs and speed is the only way this model can work, since we do not have meetings, emails, phone calls etc. Besides, we have timezone differences.

If we make huge PRs traceability is gone, chances of bugs are enormous. Nobody can know what and where has been added etc.

And the scope of these projects (cactoos and jpeek) are to train you guys in the model. Don't be shy, don't be afraid that the project is moving too slowly or anything. It moves faster if the PRs are small and besides, we have to take all the time now, to make sure everybody understands how it all works.

* @since 1.0
*/
public final class TeeInputHasResult extends TypeSafeMatcher<TeeInput> {

Choose a reason for hiding this comment

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

@proshin-roman We did not discuss about this new Matcher, did we? It's nice that you did it, but there are no unit tests for it, how do we know it works? Countless new tests are relying on it to make assertions, but it (the matcher itself) is not tested at all.

Write some tests for it if you want to use it in these tests, otherwise please use simple Matchers.
Not to mention, this new matcher, together with unit tests for it, should be in a separate PR on a separate ticket, it's basically a new functionality of the library.

* @checkstyle JavadocMethodCheck (100 lines)
* @checkstyle ClassDataAbstractionCouplingCheck (100 lines)
*/
public final class TeeInputFromByteArrayTest {

Choose a reason for hiding this comment

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

@proshin-roman Just this test class and the next one are enough for this PR. No new, untested matchers, no 13 changed files etc.

@@ -0,0 +1,214 @@
/**

Choose a reason for hiding this comment

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

@proshin-roman Again, 13 files. To quote Donald Trump: "Yuge PR". Make more PRs, please, Or you can add puzzles for future PRs, however you wish. For now, in the scope of this PR, I would only accept the 2 test files above.

@amihaiemil
Copy link

amihaiemil commented Feb 23, 2018

@proshin-roman Also! Don't forget that it's all about tasks and money in this model. Nothing more: tasks and money. You spent a lot of time on this task, I imagine you are very frustarted (sorry about that). If you don't want to work on it anymore, you can just let it go, it's your choice.

Of course, 0crat will "punish" you for it, but at the end of the day it's simple maths: what do you want? Only money? Can you afford to lose reputation? Then clearly leave it, since, you will earn on this task much less than you worked.

On the other hand, if you also want to learn and push yourself forward, then finish it, but keep in mind this is not a school -- it's all really cold. Nobody cares about anything besides closing a task. Nobody will reward you if you work harder, do overtime etc.

@proshin-roman
Copy link
Contributor Author

proshin-roman commented Feb 23, 2018

@amihaiemil Thanks for your effort on these explanations. I really appreciate it as you waste your time on this pull request as well. I'm trying to get this methodology working for myself, so I don't worry much about my extra time. Could you explain please which of these two options would be right then?

  • I submit only the first two tests (that you've accepted)
  • and I create puzzles about missing tests
  • and I close this ticket
    OR
  • I submit only the first two tests (accepted)
  • and I create puzzles about missing tests
  • and I change the status of this ticket to "waiting" on those new tickets.

I guess the first option should be right, but the problem is that the ticket is still not fixed (test coverage is not 100%).

@amihaiemil
Copy link

@proshin-roman The first option is definetely better. Always close the ticket with puzzles, rather than adding impediments to it, if possible. Sometimes, there may truly be impediments to be added, but this is not the case.

The original ticket (adding coverage of 100%) was simply too big for 30min. So, naturally, add some tests for it and puzzle the rest out.

And don't forget about that new Matcher -- decide what you do with it? Want to write unit tests for it or use simple matchers? I would honestly use simple matchers since that is a new functionality, as I said, and then the ARCH will also take more time to review etc.

Then, when the matcher is solved, I will have a last, short look over the tests 2 test classes :D They are short so shouldn't be a problem.

@proshin-roman
Copy link
Contributor Author

@amihaiemil ok, thanks! it's getting better and clearer :) Gonna do the first option (without matcher of course - will create a new puzzle for that too).

@proshin-roman
Copy link
Contributor Author

@amihaiemil I did that finally :) Review it again, please.

@0crat
Copy link
Collaborator

0crat commented Feb 25, 2018

@amihaiemil/z this job was assigned to you 5 days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please.

@proshin-roman
Copy link
Contributor Author

@amihaiemil could you review this pull request again, please? It should be ok now.

Copy link

@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.

@proshin-roman looks ok now. Just 2 comments about the puzzles formatting.

@@ -45,6 +45,9 @@
* @author Yegor Bugayenko ([email protected])
* @version $Id$
* @since 0.1
* @todo #631 This class needs more test cases. Currently, only a set of

Choose a reason for hiding this comment

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

@proshin-roman second and third line of this puzzle should start with a space. Also, add the estimation:

@todo #631:30min This class needs more test cases. Currently, only a set of
 ctors is covered by tests: ctors which use Bytes and byte array as an
 input. All other ctors should be covered too.

Copy link
Contributor Author

@proshin-roman proshin-roman Feb 26, 2018

Choose a reason for hiding this comment

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

@amihaiemil I've fixed both new comments. Btw: Qulice usually checks indentation for JavaDocs, but skips these two problems - that's a bit strange :)

* @author Roman Proshin ([email protected])
* @version $Id$
* @since 1.0
* @todo #631 Create a new Matcher that will compare results of TeeInput as

Choose a reason for hiding this comment

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

@proshin-roman Same here, second line starts with a space and add estimation :30min

@amihaiemil
Copy link

@rultor good to merge

@rultor
Copy link
Collaborator

rultor commented Feb 26, 2018

@rultor good to merge

@amihaiemil Thanks for your request. @yegor256 Please confirm this.

@amihaiemil
Copy link

amihaiemil commented Feb 26, 2018

@proshin-roman and please, update the PR's description. Something like: "Pull request for the issue #631 Started adding tests for TeeInput's ctors. Started with the Byte and ByteArray ctors and left puzzles for continuing implementing tests"

@proshin-roman
Copy link
Contributor Author

@yegor256 That's what I've tried to do, but found it not possible: the original TeeInput class has already about 1k lines, so the test will definitely contain more and that will lead to checkstyle warnings which cannot be suppressed. The only option to reach "one class - one test" would be to split TeeInput itself, but don't think it's a good idea.

@amihaiemil
Copy link

@yegor256 I also think we should have more test classes (1 per ctor input). So one for ByteArray ctors, one for Byte ctors etc. It is too much to have them all in one test class, it loses its purpose.. at least the purpose of documentation. People want to check out the unit tests and learn how to use the class; if they find a test class with 10k LoC, that's useless...

@amihaiemil
Copy link

@yegor256 besides, we should really find some balance, somehow. CR does a review, asks for changes, and then the ARCH comes and asks the exact oposite; this is not ok. But maybe a topic for discussion in another Issue :)

@yegor256
Copy link
Owner

@proshin-roman OK, let it be

@yegor256
Copy link
Owner

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Feb 27, 2018

@rultor merge

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

@rultor
Copy link
Collaborator

rultor commented Feb 27, 2018

@rultor merge

@proshin-roman @yegor256 Oops, I failed. You can see the full log here (spent 9min)

Reading src/main/java/org/cactoos/iterator/Cycled.java...
Reading src/main/java/org/cactoos/iterator/LengthOf.java...
Reading src/main/java/org/cactoos/iterator/Sorted.java...
Reading src/main/java/org/cactoos/iterator/package-info.java...
Reading src/main/java/org/cactoos/iterator/Mapped.java...
Reading src/main/java/org/cactoos/iterator/Endless.java...
Reading src/main/java/org/cactoos/iterator/Partitioned.java...
Reading src/main/java/org/cactoos/iterator/IteratorNoNulls.java...
Reading src/main/java/org/cactoos/iterator/Repeated.java...
Reading src/main/java/org/cactoos/iterator/Shuffled.java...
Reading src/main/java/org/cactoos/iterator/IteratorOf.java...
Reading src/main/java/org/cactoos/time/OffsetDateTimeOf.java...
Reading src/main/java/org/cactoos/time/LocalDateTimeAsText.java...
Reading src/main/java/org/cactoos/time/LocalDateTimeOf.java...
Reading src/main/java/org/cactoos/time/package-info.java...
Reading src/main/java/org/cactoos/time/OffsetDateTimeAsText.java...
Reading src/main/java/org/cactoos/time/DateOf.java...
Reading src/main/java/org/cactoos/time/LocalDateAsText.java...
Reading src/main/java/org/cactoos/time/DateAsText.java...
Reading src/main/java/org/cactoos/time/ZonedDateTimeAsText.java...
Reading src/main/java/org/cactoos/time/ZonedDateTimeOf.java...
Reading src/main/java/org/cactoos/time/Iso.java...
Reading src/main/java/org/cactoos/BiFunc.java...
Reading src/main/java/org/cactoos/map/StickyMap.java...
Reading src/main/java/org/cactoos/map/MapEnvelope.java...
Reading src/main/java/org/cactoos/map/MapOf.java...
Reading src/main/java/org/cactoos/map/package-info.java...
Reading src/main/java/org/cactoos/map/MapNoNulls.java...
Reading src/main/java/org/cactoos/map/MapEntry.java...
Reading src/main/java/org/cactoos/map/Grouped.java...
Reading src/main/java/org/cactoos/map/SolidMap.java...
Reading src/main/java/org/cactoos/map/SyncMap.java...
Reading src/main/java/org/cactoos/Input.java...
Reading src/main/java/org/cactoos/list/SolidList.java...
Reading src/main/java/org/cactoos/list/Joined.java...
Reading src/main/java/org/cactoos/list/ListEnvelope.java...
Reading src/main/java/org/cactoos/list/Sorted.java...
Reading src/main/java/org/cactoos/list/ListOf.java...
Reading src/main/java/org/cactoos/list/package-info.java...
Reading src/main/java/org/cactoos/list/Mapped.java...
Reading src/main/java/org/cactoos/list/ListNoNulls.java...
Reading src/main/java/org/cactoos/list/StickyList.java...
Reading src/main/java/org/cactoos/list/Shuffled.java...
Reading src/main/java/org/cactoos/list/SyncList.java...
Reading src/main/java/org/cactoos/Scalar.java...
Reading src/main/java/org/cactoos/matchers/TextHasString.java...
Reading src/main/java/org/cactoos/matchers/ScalarHasValue.java...
Reading src/main/java/org/cactoos/matchers/FuncApplies.java...
Reading src/main/java/org/cactoos/matchers/package-info.java...
Reading src/main/java/org/cactoos/matchers/MatcherOf.java...
Reading src/main/java/org/cactoos/matchers/RunsInThreads.java...
Reading src/main/java/org/cactoos/matchers/InputHasContent.java...
Reading src/verifier/verifications.xml...
Reading pom.xml...
Reading .gitattributes...
\u001b[31mERROR\u001b[0m: Puzzle src/test/java/org/cactoos/io/TeeInputFromBytesTest.java:41-42 has a very short description of just 19 words while a minimum of 20 is required
\u001b[31mERROR\u001b[0m: 1 errors, see log above. If you can't understand the cause of this issue or you don't know how to fix it, please submit a GitHub issue, we will try to help you: https://github.com/yegor256/pdd/issues. This tool is still in its beta version and we will appreciate your feedback. Here is where you can find more documentation: https://github.com/yegor256/pdd/blob/master/README.md.
Exit code is 1
container 8440872c0c96d386a60b793fa2ce3b221e8bf788f869b7ea8a28be8c09a8423c is dead
Tue Feb 27 12:22:46 CET 2018

@proshin-roman
Copy link
Contributor Author

@amihaiemil @yegor256 I've extended puzzle's description (didn't know about this constraint at all).

@amihaiemil
Copy link

@yegor256 can we try to merge again pls?

@yegor256
Copy link
Owner

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Feb 28, 2018

@rultor merge

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

@rultor rultor merged commit 0e7628a into yegor256:master Feb 28, 2018
@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

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

@rultor
Copy link
Collaborator

rultor commented Feb 28, 2018

@rultor merge

@yegor256 Done! FYI, the full log is here (took me 14min)

@amihaiemil
Copy link

@ypshenychka Can you review this one soon, there are only 2 days left

@ypshenychka
Copy link

@0crat quality good

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

@0crat quality good (here)

@ypshenychka Job gh:yegor256/cactoos#698 is not assigned, can't get start time

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

@0crat quality good (here)

@ypshenychka Job gh:yegor256/cactoos#698 is not assigned, can't get start time

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

QA review completed: +8 points just awarded to @ypshenychka/z

@0crat 0crat removed the scope label Feb 28, 2018
@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

QA review completed: +8 points just awarded to @ypshenychka/z

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

QA review completed: +8 points just awarded to @ypshenychka/z

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

Order was finished, quality was "good": +20 points just awarded to @amihaiemil/z

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

@0crat quality good (here)

@ypshenychka The job #698 is now out of scope

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

Payment to ARC for a closed pull request, as in §28: +10 points just awarded to @yegor256/z

@yegor256
Copy link
Owner

@0crat status

@0crat
Copy link
Collaborator

0crat commented Feb 28, 2018

@0crat status (here)

@yegor256 This is what I know about this job, as in §32:

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.

7 participants