Question: How can I create a JUnit test for a method like the one below: public int promptForMenuSelection(String prompt) { int menuSelection; System.out.print(prompt); try { menuSelection

How can I create a JUnit test for a method like the one below: public int promptForMenuSelection(String prompt) { int menuSelection; System.out.print(prompt); try { menuSelection = Integer.parseInt(scanner.nextLine()); } catch (NumberFormatException e) { menuSelection = -1; } return menuSelection; } 

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 Databases Questions!