diff --git a/src/main/java/edu/unl/cse/soft160/conditionals/Caucus.java b/src/main/java/edu/unl/cse/soft160/conditionals/Caucus.java index 83a08d01978d6a2c690fac9c90018cf2d7bfa0ef..2329e9eff8f728ac43450eb0fbe3113bdddf4a36 100644 --- a/src/main/java/edu/unl/cse/soft160/conditionals/Caucus.java +++ b/src/main/java/edu/unl/cse/soft160/conditionals/Caucus.java @@ -3,15 +3,15 @@ package edu.unl.cse.soft160.conditionals; import java.util.Scanner; public class Caucus { - public static void main(String... arguments) { - Scanner scanner = new Scanner(System.in); - System.out.print("Is today a caucus day (yes/no)? "); - boolean isCaucusDay = scanner.nextLine().matches("[Yy].*"); - System.out.print("Is the precinct report a correctly-formatted electronic report (yes/no)? "); - boolean isCorrectlyFormattedReport = scanner.nextLine().matches("[Yy].*"); - System.out.print("Is the precinct report a telephoned report (yes/no)? "); - boolean isTelephonedReport = scanner.nextLine().matches("[Yy].*"); - // [write code here] - scanner.close(); - } + public static void main(String... arguments) { + Scanner scanner = new Scanner(System.in); + System.out.print("Is today a caucus day (yes/no)? "); + boolean isCaucusDay = scanner.nextLine().matches("[Yy].*"); + System.out.print("Is the precinct report a correctly-formatted electronic report (yes/no)? "); + boolean isCorrectlyFormattedReport = scanner.nextLine().matches("[Yy].*"); + System.out.print("Is the precinct report a telephoned report (yes/no)? "); + boolean isTelephonedReport = scanner.nextLine().matches("[Yy].*"); + // [write code here] + scanner.close(); + } } diff --git a/src/test/java/edu/unl/cse/soft160/conditionals/CaucusTest.java b/src/test/java/edu/unl/cse/soft160/conditionals/CaucusTest.java index 84f32e374f171b1261b329314d12213901f206ea..2ec2c0a9dcffadecdc6ab69cb65029d76a849204 100644 --- a/src/test/java/edu/unl/cse/soft160/conditionals/CaucusTest.java +++ b/src/test/java/edu/unl/cse/soft160/conditionals/CaucusTest.java @@ -10,91 +10,91 @@ import java.io.ByteArrayOutputStream; import static org.junit.Assert.*; public class CaucusTest { - protected static String assemble(String... lines) { - return String.join("\n", lines) + "\n"; - } + protected static String assemble(String... lines) { + return String.join("\n", lines) + "\n"; + } - protected static String runMain(String... inputs) { - InputStream in = System.in; - PrintStream out = System.out; - System.setIn(new ByteArrayInputStream(assemble(inputs).getBytes())); - ByteArrayOutputStream collector = new ByteArrayOutputStream(); - System.setOut(new PrintStream(collector)); - Caucus.main(); - System.setIn(in); - System.setOut(out); - return collector.toString(); - } + protected static String runMain(String... inputs) { + InputStream in = System.in; + PrintStream out = System.out; + System.setIn(new ByteArrayInputStream(assemble(inputs).getBytes())); + ByteArrayOutputStream collector = new ByteArrayOutputStream(); + System.setOut(new PrintStream(collector)); + Caucus.main(); + System.setIn(in); + System.setOut(out); + return collector.toString(); + } - @Test - public void testInvalidReportNotOnCaucusDay() { - assertEquals( - assemble("Is today a caucus day (yes/no)? " - + "Is the precinct report a correctly-formatted electronic report (yes/no)? " - + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), - runMain("no", "no", "no")); - } + @Test + public void testInvalidReportNotOnCaucusDay() { + assertEquals( + assemble("Is today a caucus day (yes/no)? " + + "Is the precinct report a correctly-formatted electronic report (yes/no)? " + + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), + runMain("no", "no", "no")); + } - @Test - public void testTelephoneReportNotOnCaucusDay() { - assertEquals( - assemble("Is today a caucus day (yes/no)? " - + "Is the precinct report a correctly-formatted electronic report (yes/no)? " - + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), - runMain("no", "no", "yes")); - } + @Test + public void testTelephoneReportNotOnCaucusDay() { + assertEquals( + assemble("Is today a caucus day (yes/no)? " + + "Is the precinct report a correctly-formatted electronic report (yes/no)? " + + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), + runMain("no", "no", "yes")); + } - @Test - public void testWellFormattedElectronicReportNotOnCaucusDay() { - assertEquals( - assemble("Is today a caucus day (yes/no)? " - + "Is the precinct report a correctly-formatted electronic report (yes/no)? " - + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), - runMain("no", "yes", "no")); - } + @Test + public void testWellFormattedElectronicReportNotOnCaucusDay() { + assertEquals( + assemble("Is today a caucus day (yes/no)? " + + "Is the precinct report a correctly-formatted electronic report (yes/no)? " + + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), + runMain("no", "yes", "no")); + } - @Test - public void testDuplicatedReportNotOnCaucusDay() { - assertEquals( - assemble("Is today a caucus day (yes/no)? " - + "Is the precinct report a correctly-formatted electronic report (yes/no)? " - + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), - runMain("no", "yes", "yes")); - } + @Test + public void testDuplicatedReportNotOnCaucusDay() { + assertEquals( + assemble("Is today a caucus day (yes/no)? " + + "Is the precinct report a correctly-formatted electronic report (yes/no)? " + + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), + runMain("no", "yes", "yes")); + } - @Test - public void testInvalidReportOnCaucusDay() { - assertEquals( - assemble("Is today a caucus day (yes/no)? " - + "Is the precinct report a correctly-formatted electronic report (yes/no)? " - + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), - runMain("yes", "no", "no")); - } + @Test + public void testInvalidReportOnCaucusDay() { + assertEquals( + assemble("Is today a caucus day (yes/no)? " + + "Is the precinct report a correctly-formatted electronic report (yes/no)? " + + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report rejected"), + runMain("yes", "no", "no")); + } - @Test - public void testTelephoneReportOnCaucusDay() { - assertEquals( - assemble("Is today a caucus day (yes/no)? " - + "Is the precinct report a correctly-formatted electronic report (yes/no)? " - + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report accepted"), - runMain("yes", "no", "yes")); - } + @Test + public void testTelephoneReportOnCaucusDay() { + assertEquals( + assemble("Is today a caucus day (yes/no)? " + + "Is the precinct report a correctly-formatted electronic report (yes/no)? " + + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report accepted"), + runMain("yes", "no", "yes")); + } - @Test - public void testWellFormattedElectronicReportOnCaucusDay() { - assertEquals( - assemble("Is today a caucus day (yes/no)? " - + "Is the precinct report a correctly-formatted electronic report (yes/no)? " - + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report accepted"), - runMain("yes", "yes", "no")); - } + @Test + public void testWellFormattedElectronicReportOnCaucusDay() { + assertEquals( + assemble("Is today a caucus day (yes/no)? " + + "Is the precinct report a correctly-formatted electronic report (yes/no)? " + + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report accepted"), + runMain("yes", "yes", "no")); + } - @Test - public void testDuplicatedReportOnCaucusDay() { - assertEquals( - assemble("Is today a caucus day (yes/no)? " - + "Is the precinct report a correctly-formatted electronic report (yes/no)? " - + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report accepted"), - runMain("yes", "yes", "yes")); - } + @Test + public void testDuplicatedReportOnCaucusDay() { + assertEquals( + assemble("Is today a caucus day (yes/no)? " + + "Is the precinct report a correctly-formatted electronic report (yes/no)? " + + "Is the precinct report a telephoned report (yes/no)? " + "Precinct report accepted"), + runMain("yes", "yes", "yes")); + } } diff --git a/src/test/java/edu/unl/cse/soft160/conditionals/SpeedLimitTest.java b/src/test/java/edu/unl/cse/soft160/conditionals/SpeedLimitTest.java index f0c89cf483208c08e9f0a0eff1e435fe49a50e26..f4875f479f8ab329bacc497bd19f1ee5a9316378 100644 --- a/src/test/java/edu/unl/cse/soft160/conditionals/SpeedLimitTest.java +++ b/src/test/java/edu/unl/cse/soft160/conditionals/SpeedLimitTest.java @@ -10,187 +10,187 @@ import java.io.PrintStream; import static org.junit.Assert.*; public class SpeedLimitTest { - protected static String assemble(String... lines) { - return String.join("\n", lines) + "\n"; - } - - protected static String runMain(String... inputs) { - InputStream in = System.in; - PrintStream out = System.out; - System.setIn(new ByteArrayInputStream(assemble(inputs).getBytes())); - ByteArrayOutputStream collector = new ByteArrayOutputStream(); - System.setOut(new PrintStream(collector)); - SpeedLimit.main(); - System.setIn(in); - System.setOut(out); - return collector.toString(); - } - - @Test - public void testStoppedOnResidentialStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("0.0", "yes", "no")); - } - - @Test - public void testStoppedOnOtherStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("0.0", "no", "no")); - } - - @Test - public void testStoppedInResidentialSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("0.0", "yes", "yes")); - } - - @Test - public void testStoppedInOtherSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("0.0", "no", "yes")); - } - - @Test - public void testSlowOnResidentialStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.0", "yes", "no")); - } - - @Test - public void testSlowOnOtherStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.0", "no", "no")); - } - - @Test - public void testSlowInResidentialSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.0", "yes", "yes")); - } - - @Test - public void testSlowInOtherSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.0", "no", "yes")); - } - - @Test - public void testAlmostSlowOnResidentialStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.1", "yes", "no")); - } - - @Test - public void testAlmostSlowOnOtherStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.1", "no", "no")); - } - - @Test - public void testAlmostSlowInResidentialSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("25.1", "no", "yes")); - } - - @Test - public void testAlmostSlowInOtherSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("25.1", "no", "yes")); - } - - @Test - public void testModerateOnResidentialStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("40.0", "yes", "no")); - } - - @Test - public void testModerateOnOtherStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("40.0", "no", "no")); - } - - @Test - public void testModerateInResidentialSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.0", "yes", "yes")); - } - - @Test - public void testModerateInOtherSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.0", "no", "yes")); - } - - @Test - public void testAlmostModerateOnResidentialStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.1", "yes", "no")); - } - - @Test - public void testAlmostModerateOnOtherStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("40.1", "no", "no")); - } - - @Test - public void testAlmostModerateInResidentialSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.1", "yes", "yes")); - } - - @Test - public void testAlmostModerateInOtherSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.1", "no", "yes")); - } - - @Test - public void testFastOnResidentialStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.0", "yes", "no")); - } - - @Test - public void testFastOnOtherStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("70.0", "no", "no")); - } - - @Test - public void testFastInResidentialSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.0", "yes", "yes")); - } - - @Test - public void testFastInOtherSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.0", "no", "yes")); - } - - @Test - public void testVertFastOnResidentialStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.1", "yes", "no")); - } - - @Test - public void testVertFastOnOtherStreet() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.1", "no", "no")); - } - - @Test - public void testVertFastInResidentialSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.1", "yes", "yes")); - } - - @Test - public void testVertFastInOtherSchoolZone() { - assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " - + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.1", "no", "yes")); - } + protected static String assemble(String... lines) { + return String.join("\n", lines) + "\n"; + } + + protected static String runMain(String... inputs) { + InputStream in = System.in; + PrintStream out = System.out; + System.setIn(new ByteArrayInputStream(assemble(inputs).getBytes())); + ByteArrayOutputStream collector = new ByteArrayOutputStream(); + System.setOut(new PrintStream(collector)); + SpeedLimit.main(); + System.setIn(in); + System.setOut(out); + return collector.toString(); + } + + @Test + public void testStoppedOnResidentialStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("0.0", "yes", "no")); + } + + @Test + public void testStoppedOnOtherStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("0.0", "no", "no")); + } + + @Test + public void testStoppedInResidentialSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("0.0", "yes", "yes")); + } + + @Test + public void testStoppedInOtherSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("0.0", "no", "yes")); + } + + @Test + public void testSlowOnResidentialStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.0", "yes", "no")); + } + + @Test + public void testSlowOnOtherStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.0", "no", "no")); + } + + @Test + public void testSlowInResidentialSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.0", "yes", "yes")); + } + + @Test + public void testSlowInOtherSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.0", "no", "yes")); + } + + @Test + public void testAlmostSlowOnResidentialStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.1", "yes", "no")); + } + + @Test + public void testAlmostSlowOnOtherStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("25.1", "no", "no")); + } + + @Test + public void testAlmostSlowInResidentialSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("25.1", "no", "yes")); + } + + @Test + public void testAlmostSlowInOtherSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("25.1", "no", "yes")); + } + + @Test + public void testModerateOnResidentialStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("40.0", "yes", "no")); + } + + @Test + public void testModerateOnOtherStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("40.0", "no", "no")); + } + + @Test + public void testModerateInResidentialSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.0", "yes", "yes")); + } + + @Test + public void testModerateInOtherSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.0", "no", "yes")); + } + + @Test + public void testAlmostModerateOnResidentialStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.1", "yes", "no")); + } + + @Test + public void testAlmostModerateOnOtherStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("40.1", "no", "no")); + } + + @Test + public void testAlmostModerateInResidentialSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.1", "yes", "yes")); + } + + @Test + public void testAlmostModerateInOtherSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("40.1", "no", "yes")); + } + + @Test + public void testFastOnResidentialStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.0", "yes", "no")); + } + + @Test + public void testFastOnOtherStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Safe"), runMain("70.0", "no", "no")); + } + + @Test + public void testFastInResidentialSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.0", "yes", "yes")); + } + + @Test + public void testFastInOtherSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.0", "no", "yes")); + } + + @Test + public void testVertFastOnResidentialStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.1", "yes", "no")); + } + + @Test + public void testVertFastOnOtherStreet() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.1", "no", "no")); + } + + @Test + public void testVertFastInResidentialSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.1", "yes", "yes")); + } + + @Test + public void testVertFastInOtherSchoolZone() { + assertEquals(assemble("What is the car's speed (in km/h)? " + "Is the car on a residential street (yes/no)? " + + "Is the car in a school zone (yes/no)? " + "Speeding"), runMain("70.1", "no", "yes")); + } }