// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
//     Path path();
// 
//     boolean exist();
// 
//     final class Fake implements FileSystemPath {
// 
//         private final Path path;
//         private final boolean exist;
// 
//         public Fake() {
//             this(Paths.get("."), false);
//         }
// 
//         public Fake(String path) {
//             this(Paths.get(path), false);
//         }
// 
//         public Fake(String path, boolean exist) {
//             this(Paths.get(path), exist);
//         }
// 
//         public Fake(Path path, boolean exist) {
//             this.path = path;
//             this.exist = exist;
//         }
// 
//         @Override
//         public Path path() {
//             return path;
//         }
// 
//         @Override
//         public boolean exist() {
//             return exist;
//         }
//     }
// }
// 
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
//     public KernelException(String message) {
//         super(message);
//     }
// 
//     public KernelException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public KernelException(Throwable cause) {
//         super(cause);
//     }
// }
// 
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
//     public SuiteException(String message) {
//         super(message);
//     }
// 
//     public SuiteException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public SuiteException(Throwable cause) {
//         super(cause);
//     }
// }


import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
import org.testng.ISuite;
import org.testng.ISuiteListener;
package org.tatools.sunshine.testng;


/**
 * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com)
 * @version $Id$
 * @since 0.2
 */
public class TestNGKernelTest {

    @Test
    public void status() throws KernelException {
        MatcherAssert.assertThat(
                new TestNGKernel(() -> new FileSystemPath.Fake("src/test/resources/testng.xml"))
                        .status()
                        .code(),
                Matchers.equalTo((short) 0));
    }

    @Test(expected = KernelException.class)
    public void runWithFail() throws KernelException {
        new TestNGKernel(
                        () -> {
                            throw new SuiteException("Fail");
                        })
                .status();
    }

    @Test
    public void with() throws KernelException {
        final Listener l1 = new Listener();
        final Listener l2 = new Listener();
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
//     Path path();
// 
//     boolean exist();
// 
//     final class Fake implements FileSystemPath {
// 
//         private final Path path;
//         private final boolean exist;
// 
//         public Fake() {
//             this(Paths.get("."), false);
//         }
// 
//         public Fake(String path) {
//             this(Paths.get(path), false);
//         }
// 
//         public Fake(String path, boolean exist) {
//             this(Paths.get(path), exist);
//         }
// 
//         public Fake(Path path, boolean exist) {
//             this.path = path;
//             this.exist = exist;
//         }
// 
//         @Override
//         public Path path() {
//             return path;
//         }
// 
//         @Override
//         public boolean exist() {
//             return exist;
//         }
//     }
// }
// 
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
//     public KernelException(String message) {
//         super(message);
//     }
// 
//     public KernelException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public KernelException(Throwable cause) {
//         super(cause);
//     }
// }
// 
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
//     public SuiteException(String message) {
//         super(message);
//     }
// 
//     public SuiteException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public SuiteException(Throwable cause) {
//         super(cause);
//     }
// }


// Path: sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
import org.testng.ISuite;
import org.testng.ISuiteListener;

package org.tatools.sunshine.testng;


/**
 * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com)
 * @version $Id$
 * @since 0.2
 */
public class TestNGKernelTest {

    @Test
    public void status() throws KernelException {
        MatcherAssert.assertThat(
                new TestNGKernel(() -> new FileSystemPath.Fake("src/test/resources/testng.xml"))
                        .status()
                        .code(),
                Matchers.equalTo((short) 0));
    }

    @Test(expected = KernelException.class)
    public void runWithFail() throws KernelException {
        new TestNGKernel(
                        () -> {
                            throw new SuiteException("Fail");
                        })
                .status();
    }

    @Test
    public void with() throws KernelException {
        final Listener l1 = new Listener();
        final Listener l2 = new Listener();
        new TestNGKernel(() -> new FileSystemPath.Fake("src/test/resources/testng.xml"))