Writing a test with scanner class support in java

I’m trying to write tests that their inputs come from scanner Class in java but I have no idea whether I should use Unit Testing or Input/Output testing service in order to set up my tests. For example,
how can I set up the below code as a test? Note: the number that comes from the keyboard is dynamic; it can be any random number.

Scanner input = new Scanner(System.in);
System.out.println(“Enter a number:”);
int number = input.nextInt();
System.out.println(number +" is even");
} else if(number%2==1){
System.out.println(number+" is odd");