This approach makes testing protected methods much easier because the test case class can now extend the class that contains the protected methods.
这种方法使得测试受保护的方法非常容易,因为测试案例类现在可以扩展包含受保护方法的类了。
One of the most useful of these is the PrivateAccessor class, which makes testing private methods a snap regardless of your testing framework of choice.
其中最有用的一个就是privateaccessor类,它把对private方法的测试变成小菜一碟,无论选择的测试框架是什么。
Each of these unit test methods takes an object of a specific class and a string (where the string is expected to be the name of the getter method that you are testing).
每个单元测试方法获取一个具体类的对象和一个字符串(字符串应该是您在测试的getter方法的名称)。
应用推荐