/* * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.execution; import com.intellij.execution.testframework.sm.runner.BaseSMTRunnerTestCase; import com.intellij.execution.testframework.sm.runner.GeneralToSMTRunnerEventsConvertor; import com.intellij.execution.testframework.sm.runner.SMTestProxy; import com.intellij.execution.testframework.sm.runner.history.ImportedToGeneralTestEventsConverter; import com.intellij.openapi.util.Disposer; import java.io.StringReader; import java.util.List; public class AntImportTest extends BaseSMTRunnerTestCase { private GeneralToSMTRunnerEventsConvertor myEventsProcessor; private SMTestProxy.SMRootTestProxy myRootNode; @Override protected void setUp() throws Exception { super.setUp(); myRootNode = new SMTestProxy.SMRootTestProxy(); myEventsProcessor = new GeneralToSMTRunnerEventsConvertor(getProject(), myRootNode, "SMTestFramework"); myEventsProcessor.onStartTesting(); } @Override protected void tearDown() throws Exception { myEventsProcessor.onFinishTesting(); Disposer.dispose(myEventsProcessor); Disposer.dispose(myRootNode); myRootNode = null; myEventsProcessor = null; super.tearDown(); } public void testAntFormatTest() throws Exception { String fileText = "\n" + "\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n"; ImportedToGeneralTestEventsConverter.parseTestResults(() -> new StringReader(fileText), myEventsProcessor); final List children = myRootNode.getChildren(); assertEquals(1, children.size()); final SMTestProxy suite = children.get(0); assertEquals("MyTest", suite.getName()); final List tests = suite.getChildren(); assertEquals(3, tests.size()); assertEquals("testA1", tests.get(0).getName()); } }