All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tatools.sunshine.testng.TestNGTest Maven / Gradle / Ivy

There is a newer version: 0.7.0
Show newest version
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()
                )
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy