Search in sources :

Example 1 with OutputToGeneralTestEventsConverter

use of com.intellij.execution.testframework.sm.runner.OutputToGeneralTestEventsConverter in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoEventsConverterTestCase method doTest.

protected void doTest() {
    Executor executor = new DefaultRunExecutor();
    GoTestRunConfiguration runConfig = new GoTestRunConfiguration(myFixture.getProject(), "", GoTestRunConfigurationType.getInstance());
    runConfig.setTestFramework(getTestFramework());
    GoTestConsoleProperties consoleProperties = new GoTestConsoleProperties(runConfig, executor);
    GoTestEventsConverterBase converter = (GoTestEventsConverterBase) consoleProperties.createTestEventsConverter("gotest", consoleProperties);
    LoggingServiceMessageVisitor serviceMessageVisitor = new LoggingServiceMessageVisitor();
    try {
        for (String line : FileUtil.loadLines(new File(getTestDataPath(), getTestName(true) + ".txt"), CharsetToolkit.UTF8)) {
            converter.processServiceMessages(line + "\n", ProcessOutputTypes.STDOUT, serviceMessageVisitor);
        }
    } catch (IOException | ParseException e) {
        throw new RuntimeException(e);
    }
    ((OutputToGeneralTestEventsConverter) converter).flushBufferBeforeTerminating();
    Disposer.dispose((OutputToGeneralTestEventsConverter) converter);
    assertSameLinesWithFile(getTestDataPath() + "/" + getTestName(true) + "-expected.txt", serviceMessageVisitor.getLog());
}
Also used : OutputToGeneralTestEventsConverter(com.intellij.execution.testframework.sm.runner.OutputToGeneralTestEventsConverter) IOException(java.io.IOException) Executor(com.intellij.execution.Executor) DefaultRunExecutor(com.intellij.execution.executors.DefaultRunExecutor) ParseException(java.text.ParseException) File(java.io.File) DefaultRunExecutor(com.intellij.execution.executors.DefaultRunExecutor)

Aggregations

Executor (com.intellij.execution.Executor)1 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)1 OutputToGeneralTestEventsConverter (com.intellij.execution.testframework.sm.runner.OutputToGeneralTestEventsConverter)1 File (java.io.File)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1