Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1d9cfdc

Browse files
author
zhupeiquan
committed
How_to_test_a_class_that_has_private_methods,_fields_or_inner_classes
1 parent 2d17709 commit 1d9cfdc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎contents/How_to_test_a_class_that_has_private_methods,_fields_or_inner_classes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 如何使用 junit 测试 private 方法,变量或者内部类
22

3-
当你需要测试一个遗留的应用程序,且不能更改方法的可见性时,测试私有方法/属性的最好方式就是使用[反射](https://en.wikipedia.org/wiki/Reflection_%28computer_programming%29)
3+
当你需要测试一个遗留的应用程序,且不能更改方法的可见性时,那测试私有方法/属性的最好方式就是使用[反射](https://en.wikipedia.org/wiki/Reflection_%28computer_programming%29)
44

55
实际测试时,可以通过一些反射辅助类设置和获取私有(静态)的变量和调用私有(静态)方法。遵循下面的窍门,你可以很好地处理私有方法和变量的测试。
66

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /