vendredi 6 avril 2018

How JUnit detects my package-private test classes and methods [duplicate]

This question already has an answer here:

So test runner uses reflection behind the scenes to find out all the test classes and test methods. That is the reason we are suggested to keep our test class public. In my case I noticed JUnit is able to detect all my test classes and methods even if they are package-private. Since JUnit belongs to a different package, it should be not able to figure out my test classes and methods. Can somebody explain this. My JUnit version is 5.1.





Aucun commentaire:

Enregistrer un commentaire