REFACTOR: Extracting the console output redirection mechanism to the @Before and @After test methods for the test cases.