Package com.gophers.services.testCases
Class ProgramTest
java.lang.Object
com.gophers.services.testCases.ProgramTest
The ProgramTest class provides a suite of tests to verify the functionality
of the code, ensuring that it compiles and runs successfully.
This test class includes tests for compiling the submitted code and running the main method of the "ChatBotSimulation" class. It uses JUnit for testing and captures the system output for validation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetUp()Sets up the test environment by redirecting the `System.out` stream to capture output generated during the tests.voidtearDown()Restores the original `System.out` stream after each test has run.voidTests that the `compile` method of the `JavaCompileCommand` correctly compiles the submission without errors.voidtestRuns()Tests that the `main` method of the `ChatBotSimulation` class runs successfully.
-
Constructor Details
-
ProgramTest
public ProgramTest()Default constructor for the ProgramTest class. Initializes a new instance of the ProgramTest class to test program functionality.
-
-
Method Details
-
testCompiles
public void testCompiles()Tests that the `compile` method of the `JavaCompileCommand` correctly compiles the submission without errors. This test ensures that the submission code in the specified directory can be successfully compiled without issues. -
testRuns
public void testRuns()Tests that the `main` method of the `ChatBotSimulation` class runs successfully. This test verifies that invoking the `main` method of the `ChatBotSimulation` class does not throw any exceptions and completes without errors. -
setUp
public void setUp()Sets up the test environment by redirecting the `System.out` stream to capture output generated during the tests. This method is run before each test to ensure that the output stream is redirected for capturing test results. -
tearDown
public void tearDown()Restores the original `System.out` stream after each test has run. This method is executed after each test to restore the original output stream and prevent interference with other tests.
-