You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/07/10 15:05:08 UTC
[GitHub] [commons-configuration] robtimus opened a new pull request, #194: CONFIGURATION-817: update to JUnit 5
robtimus opened a new pull request, #194:
URL: https://github.com/apache/commons-configuration/pull/194
See [CONFIGURATION-817](https://issues.apache.org/jira/browse/CONFIGURATION-817), which I've based on a comment from the mailing list.
Besides upgrading JUnit 5, I needed to get rid of `junit-addons`, `mockobjects-core` and `mockobjects-jdk1.4-j2ee1.3`. The first two have dependencies on JUnit 4, the last two haven't had any updates since 2005. I've used the latest Mockito version as replacement for these last two, as it was a lot easier than using EasyMock.
Most of the changes are updated imports. In addition, all assertions with custom messages have had to be updated because now the message comes last instead of first. In some case. my IDE gave some Sonar warnings for `assertEquals` where the expected and actual arguments were swapped, I've fixed those as well. I've also used `assertThrows` instead of `try-fail-catch`.
I've also had to replace the `TemporaryFolder` rule with `@TempDir`; I've added a utility class to make the migration (both for me and for future developers) a bit easier.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r918716856
##########
src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java:
##########
@@ -198,6 +198,8 @@ public static void setUpOnce() {
private void copyFile(final File input, final File output) throws IOException {
FileUtils.copyFile(input, output, StandardCopyOption.REPLACE_EXISTING);
+ // On Windows, the last modified time is copied by default. Change the last modified time manually.
+ output.setLastModified(System.currentTimeMillis());
Review Comment:
After my changes the one test that used this method failed. I couldn't find out why my changes would have caused this, so I ran the tests on master again; the test failed there as well.
I started debugging the code, and noticed that the last modified timestamp wasn't changed. This is commented in FileUtils: https://github.com/apache/commons-io/blob/rel/commons-io-2.11.0/src/main/java/org/apache/commons/io/FileUtils.java#L849. The test clearly needed the last modified timestamp to change, something that was probably done automatically on Linux but on Windows it needed this extra step.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] darkma773r commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
darkma773r commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r918489801
##########
src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java:
##########
@@ -198,6 +198,8 @@ public static void setUpOnce() {
private void copyFile(final File input, final File output) throws IOException {
FileUtils.copyFile(input, output, StandardCopyOption.REPLACE_EXISTING);
+ // On Windows, the last modified time is copied by default. Change the last modified time manually.
+ output.setLastModified(System.currentTimeMillis());
Review Comment:
Can you explain the need for this change in more detail? Was this test not working before?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#issuecomment-1183441615
As requested in [CONFIGURATION-817](https://issues.apache.org/jira/browse/CONFIGURATION-817), I've removed most of the assertion messages (see the third commit).
I'll see if I can replace EasyMock the next few days.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r918716856
##########
src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java:
##########
@@ -198,6 +198,8 @@ public static void setUpOnce() {
private void copyFile(final File input, final File output) throws IOException {
FileUtils.copyFile(input, output, StandardCopyOption.REPLACE_EXISTING);
+ // On Windows, the last modified time is copied by default. Change the last modified time manually.
+ output.setLastModified(System.currentTimeMillis());
Review Comment:
After my changes the one test that used this method failed. I couldn't find out why my changes would have caused this, so I ran the tests on master again; the test failed there as well.
I started debugging the code, and noticed that the last modified timestamp wasn't changed. This is commented in FileUtils: https://github.com/apache/commons-io/blob/rel/commons-io-2.11.0/src/main/java/org/apache/commons/io/FileUtils.java#L849 (the first part of my comment comes from that line). The test clearly needed the last modified timestamp to change, something that was probably done automatically on Linux but on Windows it needed this extra step.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#issuecomment-1186168144
@darkma773r: done. I ran `mvn clean package` after fixing the single merge conflict, and got the one failure I expected. I ran it again at the end of rebasing and all was successful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] darkma773r commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
darkma773r commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r919614955
##########
pom.xml:
##########
@@ -475,33 +469,9 @@
</dependency>
<dependency>
- <groupId>junit-addons</groupId>
- <artifactId>junit-addons</artifactId>
- <version>1.4</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-core</artifactId>
- <version>0.09</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-jdk1.4-j2ee1.3</artifactId>
- <version>0.09</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>4.6.1</version>
Review Comment:
This gives us two separate mocking frameworks in the tests: Mockito and Easymock. Can we standardize on Mockito and remove Easymock?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r919839001
##########
pom.xml:
##########
@@ -475,33 +469,9 @@
</dependency>
<dependency>
- <groupId>junit-addons</groupId>
- <artifactId>junit-addons</artifactId>
- <version>1.4</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-core</artifactId>
- <version>0.09</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-jdk1.4-j2ee1.3</artifactId>
- <version>0.09</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>4.6.1</version>
Review Comment:
I think I can do that as separate PR, it's a bit too much work right now, especially since I'm already working on removing assertion messages (as requested in https://issues.apache.org/jira/browse/CONFIGURATION-817).
I tried using EasyMock as replacement of mockobjects first just to prevent a second mocking framework, but as far as I can tell EasyMock requires every call to be specified in order up front, whereas mockobjects and Mockito can be setup in any order (as long as the matchers are used correctly). I got so many errors that I gave up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] darkma773r commented on pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
darkma773r commented on PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#issuecomment-1186161230
@robtimus, it looks like we have a merge conflict. Could you rebase on master?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] darkma773r commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
darkma773r commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r919615186
##########
src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java:
##########
@@ -198,6 +198,8 @@ public static void setUpOnce() {
private void copyFile(final File input, final File output) throws IOException {
FileUtils.copyFile(input, output, StandardCopyOption.REPLACE_EXISTING);
+ // On Windows, the last modified time is copied by default. Change the last modified time manually.
+ output.setLastModified(System.currentTimeMillis());
Review Comment:
Weird. I wonder how we missed that before.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] darkma773r merged pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
darkma773r merged PR #194:
URL: https://github.com/apache/commons-configuration/pull/194
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r920488581
##########
pom.xml:
##########
@@ -475,33 +469,9 @@
</dependency>
<dependency>
- <groupId>junit-addons</groupId>
- <artifactId>junit-addons</artifactId>
- <version>1.4</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-core</artifactId>
- <version>0.09</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-jdk1.4-j2ee1.3</artifactId>
- <version>0.09</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>4.6.1</version>
Review Comment:
And FYI, I've just pushed a commit that replaces EasyMock with Mockito.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#issuecomment-1183658714
It took me most of the evening, but EasyMock has been replaced as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] codecov-commenter commented on pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#issuecomment-1179801713
# [Codecov](https://codecov.io/gh/apache/commons-configuration/pull/194?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#194](https://codecov.io/gh/apache/commons-configuration/pull/194?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (eafd86c) into [master](https://codecov.io/gh/apache/commons-configuration/commit/45094543274bbc8ac663ce2008697c0e7fdb7f1a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (4509454) will **not change** coverage.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #194 +/- ##
=========================================
Coverage 89.46% 89.46%
Complexity 3602 3602
=========================================
Files 183 183
Lines 9988 9988
Branches 1352 1352
=========================================
Hits 8936 8936
Misses 768 768
Partials 284 284
```
| [Impacted Files](https://codecov.io/gh/apache/commons-configuration/pull/194?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...commons/configuration2/tree/InMemoryNodeModel.java](https://codecov.io/gh/apache/commons-configuration/pull/194/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29uZmlndXJhdGlvbjIvdHJlZS9Jbk1lbW9yeU5vZGVNb2RlbC5qYXZh) | `96.94% <0.00%> (-0.39%)` | :arrow_down: |
| [.../commons/configuration2/tree/ModelTransaction.java](https://codecov.io/gh/apache/commons-configuration/pull/194/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2NvbW1vbnMvY29uZmlndXJhdGlvbjIvdHJlZS9Nb2RlbFRyYW5zYWN0aW9uLmphdmE=) | `98.61% <0.00%> (+0.46%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/commons-configuration/pull/194?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/commons-configuration/pull/194?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [4509454...eafd86c](https://codecov.io/gh/apache/commons-configuration/pull/194?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r920388413
##########
pom.xml:
##########
@@ -475,33 +469,9 @@
</dependency>
<dependency>
- <groupId>junit-addons</groupId>
- <artifactId>junit-addons</artifactId>
- <version>1.4</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-core</artifactId>
- <version>0.09</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-jdk1.4-j2ee1.3</artifactId>
- <version>0.09</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>4.6.1</version>
Review Comment:
FYI, I'm already working on replacing EasyMock.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] robtimus commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
robtimus commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r919839608
##########
src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java:
##########
@@ -198,6 +198,8 @@ public static void setUpOnce() {
private void copyFile(final File input, final File output) throws IOException {
FileUtils.copyFile(input, output, StandardCopyOption.REPLACE_EXISTING);
+ // On Windows, the last modified time is copied by default. Change the last modified time manually.
+ output.setLastModified(System.currentTimeMillis());
Review Comment:
Perhaps the tests aren't run on Windows?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [commons-configuration] darkma773r commented on a diff in pull request #194: CONFIGURATION-817: update to JUnit 5
Posted by GitBox <gi...@apache.org>.
darkma773r commented on code in PR #194:
URL: https://github.com/apache/commons-configuration/pull/194#discussion_r919614955
##########
pom.xml:
##########
@@ -475,33 +469,9 @@
</dependency>
<dependency>
- <groupId>junit-addons</groupId>
- <artifactId>junit-addons</artifactId>
- <version>1.4</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-core</artifactId>
- <version>0.09</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>mockobjects</groupId>
- <artifactId>mockobjects-jdk1.4-j2ee1.3</artifactId>
- <version>0.09</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>4.6.1</version>
Review Comment:
This gives us two separate mocking frameworks in the tests: Mockito and Easymock. Can you standardize on Mockito and remove Easymock?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org