I have a legacy class that contains a new()
call to instantiate a LoginContext
object:
public class TestedClass {
public LoginContext login(String user, String password) {
LoginContext lc = new LoginContext("login", callbackHandler);
}
}
I want to test this class using Mockito to mock the LoginContext
as it requires that the JAAS security stuff be set up before instantiating, but I'm not sure how to do that without changing the login()
method to externalize the LoginContext
.
Is it possible using Mockito to mock the LoginContext
class?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…