jorabin / KeePassJava2

Java API for KeePass Password Databases - Read/Write 2.x (File versions 3 and 4), Read 1.x
Apache License 2.0
250 stars 71 forks source link

Don't leak JUnit4 and Jetbrains annotations as transitive dependencies #72

Closed Avalancs closed 5 days ago

Avalancs commented 1 week ago

Testing a solution for #71 . It works for me with mvn clean install -Dmaven.test.skip=true but I get some test errors, which I'm not sure if I introduced or if the develop branch fails on my machine. Would appreciate it if others tested this as well.

I had to move dom/src/test/java/org/linguafranca/pwdb/kdbx/dom/DomPropertyValueTest.java to the src/test/... folder, but I did not see any other *ValueTest files in other projects under the src folder, so it should have been in the test folder from the beginning?

Also moved MavenRunListener to the src/test folder, which fits how the documentation describes it: https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html#using-custom-listeners-and-reporters

Avalancs commented 1 week ago

My test failure is related to database/src/test/java/org/linguafranca/pwdb/PropertyValueTest.java : sealedObjectTest(). The THIS_IS_A_SECRET.getBytes() method uses the platform encoding, and if I run the test from IntelliJ Idea by hand it works fine, but if I run maven then I guess it uses the Windows encoding instead of UTF-8.

I guess it's a maven issue, not a code issue.

jorabin commented 5 days ago
  1. THIS_IS_A_SECRET.getBytes() ... this is a bug, should say THIS_IS_A_SECRET.getBytes(StandardCharsets.UTF_8)
  2. Also moved MavenRunListener to the src/test folder, if you do that then tests on other modules fail, as they can't see the class ...
jorabin commented 5 days ago

Thanks for contributing your pull request. As mentioned under my comment on #71 I decided to make some more sweeping changes, hopefully this will serve the purpose you had in mind.

Avalancs commented 3 days ago

Yes, this was a proposal, so I'm happy if you can incorporate it in any way.

Also moved MavenRunListener to the src/test folder, if you do that then tests on other modules fail, as they can't see the class

Interesting, I could do mvn install without issues, but sometimes it felt like IntelliJ Idea or maven was not quite compiling with the latest changes I was doing, even if I did a clean...