Commit fdcafa14 authored by Adam Blank's avatar Adam Blank
Browse files

Fix NSEE nonsense

parent 689436d7
No related merge requests found
Pipeline #76028 failed with stage
in 0 seconds
Showing with 13 additions and 6 deletions
+13 -6
package edu.caltech.cs2.project02;
import edu.caltech.cs2.helpers.CaptureSystemOutput;
import edu.caltech.cs2.helpers.FileSource;
import edu.caltech.cs2.helpers.Inspection;
import edu.caltech.cs2.helpers.Reflection;
import edu.caltech.cs2.helpers.*;
import edu.caltech.cs2.project02.choosers.EvilHangmanChooser;
import edu.caltech.cs2.project02.choosers.RandomHangmanChooser;
import edu.caltech.cs2.project02.guessers.ConsoleHangmanGuesser;
import edu.caltech.cs2.project02.interfaces.IHangmanChooser;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import java.io.FileNotFoundException;
......@@ -179,6 +177,7 @@ public class ChooserTests {
"trace14.txt",
}
)
public void testPlayGameWithRandomChooser(Map<String, String> arguments, String expectedOutput, CaptureSystemOutput.OutputCapture capture) throws FileNotFoundException {
// Parse arguments
int seed = Integer.parseInt(arguments.get("seed"));
......@@ -320,6 +319,7 @@ public class ChooserTests {
"trace14-evil.txt",
}
)
public void testPlayGameWithEvilChooser(Map<String, String> arguments, String expectedOutput, CaptureSystemOutput.OutputCapture capture) throws FileNotFoundException {
// Parse arguments
int length = Integer.parseInt(arguments.get("word length"));
......@@ -327,8 +327,15 @@ public class ChooserTests {
String guesses = arguments.get("guesses");
// Run the actual game
runTestGame(EvilHangmanChooser.class, length, wrongAllowed, guesses);
NoSuchElementException toThrow = null;
try {
runTestGame(EvilHangmanChooser.class, length, wrongAllowed, guesses);
} catch (NoSuchElementException e) {
toThrow = e;
}
assertEquals(expectedOutput.replace("\r\n", "\n").strip(), capture.toString().replace("\r\n", "\n").strip());
if (toThrow != null) {
throw toThrow;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment