Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

JUnit FAQ suggests private methods bad design?

0
Posted

JUnit FAQ suggests private methods bad design?

0

“Shaun Zinck” wrote in message > Private methods are not meant to be called from anything other than > the owning class/object. The point of JUnit testing is to make sure > that the inputs and outputs of an object work as expected. If each > tested input (method call, parameters) yields the expected output > (return value, object state), then the class can be considered > functional. Even if public methods call private methods, if the > outputs and inputs are correct then the private methods can be > considered correct as well. Right. That is the generally best way to handle private methods. If they are private for 1+ reasons, those reasons must be addressed to legitimate yanking them out into their own class. Plus calling overhead, and readability should be evaluated when taking that kind of step. > Private methods are tested indirectly by > testing the public methods that use them. This is known as “black box > testing”. > > Since the correctness of private met

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123