Wednesday, 14 August 2013

Junit testing for following scenario

Junit testing for following scenario

Consider the following class
public class Validator {
void startValiadation(UserBean user){
//This method is visible inside this package only
validateUser(user);
}
private static boolean validateUser(UserBean user){
//This method is visible inside this class only
boolean result=false;
//validations here
return result;
}
}
Due to security requirement of above method I did code in above way. Now I
want to wrote test cases using Junit. But generally a unit test is
intended to exercise the public interface of a class or unit. Still I can
use reflection to do some thing what I am expecting here. But I want to
know is there any other way to achieve my goal?

No comments:

Post a Comment