From ee35c510302be27a25a6d1b862648b478b34f6ab Mon Sep 17 00:00:00 2001
From: James Bowden <jbowden@caltech.edu>
Date: Tue, 17 Jan 2023 17:05:09 -0800
Subject: [PATCH] re add try catch

---
 tests/edu/caltech/cs2/lab02/GameTraceTests.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/edu/caltech/cs2/lab02/GameTraceTests.java b/tests/edu/caltech/cs2/lab02/GameTraceTests.java
index 6a12b48..e1b0211 100644
--- a/tests/edu/caltech/cs2/lab02/GameTraceTests.java
+++ b/tests/edu/caltech/cs2/lab02/GameTraceTests.java
@@ -11,6 +11,7 @@ import java.io.FileNotFoundException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.Random;
 import java.util.Scanner;
 
@@ -37,7 +38,10 @@ public class GameTraceTests {
     )
     public void testAdventureGame(Map<String, String> arguments, String expectedOutput, CaptureSystemOutput.OutputCapture capture)
             throws FileNotFoundException {
-        runTestGame(arguments.get("stdin"));
+        try {
+            runTestGame(arguments.get("stdin"));
+        } catch (NoSuchElementException e) {
+        }
         assertEquals(expectedOutput.replace("\r\n", "\n").strip(), capture.toString().replace("\r\n", "\n").strip());
     }
 
-- 
GitLab