Hey, I'm quite new to Java and I'm struggling to figure out why my method isn't being recognised by JUnit.
The code
So the goal of the provided code is to print out an int array made up of random int to the console.
String str = "";
int length = randomSequence.length;
for(int i =0; i < length; i++){
str =x[i]+"";
System.out.print(str);
}
return str;
}```
```public static void printArrayToConsole(int[] x){
String str = "";
int length = randomSequence.length;
for(int i =0; i < length; i++){
str =x[i]+"";
System.out.print(str);
}
}```
As you can see I've come up with 2 ways for this method.
The 1st returns a String, the 2nd is a void method.
Both work and print out an int array to the console, however JUnit doesn't care and gives me the same error.
## JUnit Errors
>There was 1 failure:
>1) runPrintArray(BubbleSortWithSideEffectsTest)
>java.lang.AssertionError: could not find or execute method; printArrayToConsole(...);
I can´t provide the whole JUnit, so here´s a small portion of the code:
```assertTrue("error with printArrayToConsole. Content was not printed to console",printedOutA);
System.setOut(System.out);
System.setIn(System.in);
}catch(Exception e){
throw new AssertionError("could not find or execute method; " +
"printArrayToConsole(...);");
}```
I would be very grateful if someone could explain me why none of the above methods works. Thank you in advance.