简体   繁体   中英

JUnit - some of my class methods don't appear Eclipse JUnit wizard?

When I run the wizard in Eclipse, not all my methods appear in the list to add to the new test case.

Is this to say I can't test them? Or that if I somehow can, I shouldn't test them?

Thanks.

The Eclipse wizards won't show private methods - you can't call them directly hence you can't test them directly, which might be what you are seeing.

Instead of thinking about which methods you are testing, you might however want to start thinking of testing in terms of testing the behavior of the class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM