I have a function compare which called private function compareRuleRanks, and println the error or correct message when condition met, how can I capture the message when I do unit test? I try to use AssertionError but didn't work, how can I do that?
AssertionError(dataCompare.compare("Rule1", "Rule2"));
public void compare(){
compareRuleRanks(rule1, rule2);
}
private void compareRuleRanks(rule1, rule2) {
if(rule1.rank != rule2.rank) {
println("The ranks are not in order");
}
println("rules are same");
}