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: 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()
                )
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy