-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
WIP: 343 - Document compatibility with JUnit 4 TestRules #660
WIP: 343 - Document compatibility with JUnit 4 TestRules #660
Conversation
…es/343-document-testrule-compatibility
…om:selesy/junit5 into issues/343-document-testrule-compatibility
…-document-testrule-compatibility
…-document-testrule-compatibility
- Adds output for the StopwatchVintageDemo - Adds output for the StopwatchJupiterDemo - Fixes the method signature for Jupiter's succeeding test - Adds an introduction paragraph for the section - Adds the DisableOnDebug section text - Adds the Stopwatch section text
Please review the (first) section related to replacing the I'm also at a loss for why Travis failed this time - any direction would be appreciated! |
@smoyer64 This looks like a network availability problem with maven repos:
This would warrant a rerun of the travis check, though I am not sure if or how this is possible. |
@gaganis - That's what it looked like to me too but I'm not very familiar with Travis or Gradle. I can obviously trigger a rebuild by making a junk commit (which will get squashed with everything else once I'm done with this PR) but I don't know another way either. Thanks for the second set of eyes! |
I've retriggered the Travis build and is back to green now. |
|
||
public class StopwatchVintageDemo { | ||
|
||
private static final Logger logger = Logger.getLogger(""); |
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.
Why not use Logger.getLogger(StopwatchVintageDemo.class.getName())
?
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.
The code in the vintage demonstrations was copied directly from the JUnit 4 javadocs - in this case it's at: http://junit.org/junit4/javadoc/latest/org/junit/rules/Stopwatch.html. I made changes to the JUnit 4 sample code when it wouldn't run as shown, and in this case combined both the examples in the javadocs into one file. Do you think it's worth the effort to turn the vintage examples into production-ready code? I have to admit that I completely missed that the code was logging to the root logger ... and it does feel a bit dirty!
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.
I wasn't aware that the code originated form Vintage Javadoc. However, I don't want to promote bad development practices, even though it's just example code.
@smoyer64 I've noticed that there's no visible work done on demos for Do you have any plans regarding that section? Can you give me a gist of what you intend to write up for the |
I'll try to get the ExternalFolder example committed this weekend - I was basicially going to wrap the JUnit 4 code's folder creation in a JUnit 5 extension as the first implementation. I'm sure that in the long term there will be other needs! See https://github.com/junit-team/junit4/blob/master/src/main/java/org/junit/rules/TemporaryFolder.java. |
Here's a little extension we're using internally for our tests: Maybe it could make its way into Pioneer? |
@marcphilipp - We definitely want an extension that provides an upgrade path from JUnit 4's |
I don't know about recursion, but I would encourage |
A |
What kind of recursion are you referring to? |
@sormuras That makes sense. I think allowing a user to set a custom |
My initial example is somewhere between 50 and 60 lines but if we're going to put it into Pioneer, my inclination is to replace the public API of the JUnit 4 code with the appropriate extension interfaces. Translating the JUnit 4 tests for this code should prove educational too. |
As far as the "API" of the extension I don't think it needs operations like |
Hi @smoyer64, Any chance you'll finish this documentation effort in time for the 5.1 GA release (e.g., within the next few weeks)? |
Closing due to lack of activity. |
Overview
This PR includes the tasks required to complete issue #343 with the same title as this PR.
Deliverables
ErrorCollectorJupiterDemo
to useAssertions.fail(Throwable t)
when Feature: Add fail methods that accept Throwable to Assertions #656 is complete.I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
Method preconditions are checked and documented in the method's JavadocChange is covered by automated testsPublic API has Javadoc and@API
annotations