Question: I need a JUnit test for this method only using JUnit 4 public static String DeckList ( ) { Scanner sc = new Scanner (

I need a JUnit test for this method only using JUnit 4public static String DeckList(){
Scanner sc = new Scanner(System.in);
System.out.println("Please enter which deck you'd like to see (Rapid, Imperial, Hunters, or Gallant): ");
String ListChoice = sc.nextLine();
if(ListChoice.equals("Rapid")|| ListChoice.equals("rapid")){
System.out.println("[List]");
List = "Rapid";
}
else if(ListChoice.equals("Imperial")|| ListChoice.equals("imperial")){
System.out.println("[List]");
List = "Imperial";
}
else if(ListChoice.equals("Hunters")|| ListChoice.equals("hunters")){
System.out.println("[List]");
List = "Hunters";
}
else if(ListChoice.equals("Gallant")|| ListChoice.equals("gallant")){
System.out.println("[List]");
List = "Gallant";
}
else{
System.out.println("Invalid Input. Please restart the program.");
}
sc.close();
return List;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!