This question already has an answer here:
- Any way to Invoke a private method? 5 answers
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