org.tatools.sunshine.testng.TestNGTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sunshine-testng Show documentation
Show all versions of sunshine-testng Show documentation
"The package is Sunshine's adapter for TestNG tests runner."
package org.tatools.sunshine.testng;
import org.tatools.sunshine.core.*;
import org.testng.xml.XmlClass;
import org.testng.xml.XmlTest;
import java.util.Collections;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id: dc04850b356e1255826ce18c68b4a6346d38d1ec $
* @since 0.1
*/
final class TestNGTest implements Test {
private final SunshineTest test;
TestNGTest(SunshineTest test) {
this.test = test;
}
TestNGTest(String clazz) {
this(new TestFromFile(clazz));
}
@Override
public XmlTest object() throws TestException {
XmlTest xmlTest = new XmlTest();
xmlTest.setName(test.toString());
xmlTest.setXmlClasses(Collections.singletonList(new XmlClass(test.object(), false)));
return xmlTest;
}
@Override
public boolean match(Condition condition) {
throw new UnsupportedOperationException(
String.format(
"%s is not able to handle %s condition", this.getClass().getName(), condition.getClass().getName()
)
);
}
}