Question: [Java] Junit testing case How am I supposed to deal with scanner in junit? Here are my methods I want to test. Scanner scan =

[Java] Junit testing case

How am I supposed to deal with scanner in junit?

Here are my methods I want to test.

Scanner scan = new Scanner(System.in).useDelimiter(" ");
public String prompt_FirstName() { System.out.println("First Name:"); String firstName = scan.next(); return firstName; }
public int prompt_Zip() { System.out.println("Zip:"); int zip = Integer.parseInt(scan.next()); return zip; }

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!