I have a function which should print string. I want to test through JUnit Is really the function printing what it is supposed to print. How to do it?
for example, this my function:
public static void test(int a){
System.out.println(a + "^2=" + (a*a));
}
and I want to check that for a = 3 is printing 3^2=9
Ps, I can not change the function.