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: ffb1ebcbef28b64f2e5440e8d1b150b68a75a7ac $
* @since 0.1
*/
final class TestNGTest implements Test {
private final SunshineTest test;
TestNGTest(SunshineTest test) {
this.test = test;
}
TestNGTest(String clazz) {
this(new SunshineTestBase(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()
)
);
}
}