mercredi 15 février 2017

How can we test package-private class?

I am reading book Effective Jave, in Item 13: Minimize the accessibility of classes and members, it mentioned that:

To facilitate testing, you may be tempted to make a class, interface, or member more accessible. This is fine up to a point. it is acceptable to make a private member of a public class package-private in order to test it, but it is not acceptable to raise the accessibility any higher than that. In other words, it is not acceptable to make a class, interface, or member a part of packages's exported API to facilitate testing.

How should I understand make class package-private accessible, if so How to test it?

Aucun commentaire:

Enregistrer un commentaire