I am using ActiveJDBC in my project which has a model ScriptRule
. Please find the attached code snippet.
public class RuleEvaluatorProvider {
public static RuleEvaluatorClient getRuleEvaluatorClient() throws ScriptException, IOException {
List<ScriptRule> scriptRuleList = ScriptRule.findAll();
// some processing
return new RuleEvaluatorClient(someObj);
}
}
I am using PowerMock for writing unit tests. I am facing an issue in testing the method RuleEvaluatorProvider.getRuleEvaluatorClient()
. The findAll()
method returns a org.javalite.activejdbc.LazyList<T>
object.
Therefore, a PowerMockito.when(ScriptRule.findAll()).thenReturn();
wouldn't work because I can only create a utils List. Does anybody have experience doing unit tests like these with ActiveJDBC.
Please help.