Question: Junit testing case 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 =
Junit testing case
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;}Here's what i have so far
@Testpublic void testPrompt_first(){ Menu inputOutput= new Menu(); String input = "Jane"; InputStream in = new ByteArrayInputStream(input.getBytes()); System.setIn(in); String s = inputOutput.prompt_FirstName(); assertEquals("Jane", s);} Step by Step Solution
3.60 Rating (157 Votes )
There are 3 Steps involved in it
Based on the provided code snippet it seems that you are trying to write a JUnit test case for the p... View full answer
Get step-by-step solutions from verified subject matter experts
