vendredi 16 septembre 2016

increasing the scope of methods only for junit is recommended or not?

I am working on project which includes junit testing code as well. Some where i have seen that methods are declared as default(no access specifier) and they are using it in junit for code coverage. Can anyone tell that which one is the best way to unit test the code from the below options.

  1. make the methods as default(no access specifier). Since for junit we are exposing the methods outside of class. Eventually we are exposing it only for junit.
  2. We can use reflection to test the piece of code. Because junit won't be delivered in production environment.

Aucun commentaire:

Enregistrer un commentaire