def test_javac_command_failure(self): """Tests the failure of javac command. """ file_paths = [ os.path.join(ROOT_TEST_DIR, 'multiple_java_files', CALC_TEST_FILENAME) ] # Compile java files stdout, stderr = javac(file_paths=file_paths, out_path=self.out_path, class_path=self.class_path) self.assertIsNotNone(stderr)
def test_java_command_failure_for_test(self): """Tests the failure of java command with exec_type "test". """ file_paths = [ os.path.join(ROOT_TEST_DIR, 'multiple_java_files', CALC_TEST_FILENAME) ] # Compile java files stdout, stderr = javac(file_paths=file_paths, out_path=self.out_path, class_path=self.class_path) if stdout is None and stderr is None: # Execute compiled java files result, err = java(exec_type=ExecType.run, class_path=self.class_path, main_file=None, args=[]) self.assertIsNotNone(err)
def test_java_command_success_for_run_with_args(self): """Tests the success of java command with exec_type "run" and sends args. """ file_paths = [ os.path.join(ROOT_TEST_DIR, 'arguments', HELLO_NAME_FILENAME) ] # Compile java files stdout, stderr = javac(file_paths=file_paths, out_path=self.out_path, class_path=self.class_path) if stdout is None and stderr is None: # Execute compiled java files result, err = java(exec_type=ExecType.run, class_path=self.class_path, main_file=HELLO_NAME_FILENAME.rsplit( '.', maxsplit=1)[0], args=["Alice"]) self.assertIsNone(err)
def test_java_command_success_for_run(self): """Tests the success of java command with exec_type "run". """ file_paths = [ os.path.join(ROOT_TEST_DIR, 'multiple_java_files', MAIN_FILENAME), os.path.join(ROOT_TEST_DIR, 'multiple_java_files', CALC_FILENAME) ] # Compile java files stdout, stderr = javac(file_paths=file_paths, out_path=self.out_path, class_path=self.class_path) if stdout is None and stderr is None: # Execute compiled java files result, err = java(exec_type=ExecType.run, class_path=self.class_path, main_file=MAIN_FILENAME.rsplit('.', maxsplit=1)[0], args=[]) self.assertIsNone(err)