Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

Based on the provided code snippet it seems that you are trying to write a JUnit test case for the p... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions