Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
2

How do I make input/output tests work?

GusReiber
GusReiber

I have an assignment for my students in which they write a program that takes a number of console input values and responds accordingly.

I would like to use the input/out test to help validate their code.

I am struggling to make the tests pass when there is both an input and an output on the same line. Example:

System.out.print("What should I do next: "); String whatNext = cmd.next(); System.out.println("I will do " + whatNext);

I cannot figure out how to make a passable test for this little code segment even when I use something like "good" as the input value.

If I separate the line of output from the line of input, I can make it work, but I would rather not break the program to satisfy the test.

Hoping there is something silly I am missing.

1 year ago

Voters