equalsverifier
equalsverifier copied to clipboard
Add test for Validations.validatePackageContainsClasses and Validations.validate
Hey 😊
I want to contribute a test. Curious to hear what you think!
(I wrote this test as part of a research study at TU Delft. Find out more)
- Please run
mvn spotless:apply
to format the code before opening a PR. Otherwise, GitHub Actions will complain at you 😉. Unfortunately, you will need to have Node installed to do so. → I'm having trouble here:No plugin found for prefix 'spotless' in the current project
🙁 I have node version 18.3 installed and am running on MacOS.mvn verify
passes, but no mention of spotless in there.
Looks good. No mutations were possible for these changes. Mutation testing report generated by PITest - https://pitest.org - if there are surviving mutants, please check the line comments under 'Files changed', or the full report under the 'CI / pitest' check below this comment.
Hi! Sorry for the slow reply. Thanks for the PR. Unfortunately, I already have a test that should cover this part: https://github.com/jqno/equalsverifier/blob/c874369e2566f50897c30be505a4a14a99c1c050/equalsverifier-test-core/src/test/java/nl/jqno/equalsverifier/integration/operational/MultipleTypeEqualsVerifierTest.java#L115-L124 How did you choose this particular thing to test? Maybe we can find another part to write a test for...
Regarding the message about Spotless: that's strange, it should just work, even from a submodule folder... Can you post the full error message?
Hey jqno!
Indeed, the test you points to seems to also excecute the methods I was targeting. Thanks for pointing it out & sorry for not catching it myself 🙂
I was automatically looking at tests we could generate that add new instruction coverage. Basically all for this project are checking Exceptions being thrown → picked this one out. Though from your feedback I suspect that our coverage calculation might be missing something...
The only different test case we could create was essentially checking that TypeTag.equals(null)
is false.
Is that already tested here: https://github.com/jqno/equalsverifier/blob/a9e394f1f6c6a6255c22da6c6d72c3b2e430d11a/equalsverifier-test-core/src/test/java/nl/jqno/equalsverifier/internal/prefabvalues/TypeTagTest.java#L24 ?
Otherwise, are there any areas you're currently looking to test more in your project? 😄
As for spotless, I learned that through IntelliJ it's working fine!
Hi!
Yes, EqualsVerifier checks the case where null
is passed to an equals
method, so that case should be covered.
What tool do you use to find these cases?
I'm using JaCoCo myself. If you run mvn clean verify
, you'll find in equalsverifier-aggregator/target/jacoco-internal/index.hml
a survey of stuff that is covered by the test suite. As you can see there, coverage is pretty high, and most of the uncovered paths are unreachable, like catch blocks for exceptions that are never thrown but that the compiler requires me to add. Maybe there's a couple of other things uncovered in there, of course you're very welcome to pick one of those :).
There's also a mutation coverage tool that can be used, but currently it seems to be broken, so that won't be very helpful to you unfortunately.
I'm closing this PR now, since it has become stale. I still very much appreciate your intention to add a test, even if it didn't work out. If you ever want to contribute a new test or something else, please let me know before, and I'll help you find something!