// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/api/model/TestSource.java
// public interface TestSource {
// 
//     /**
//      * @return  complete test source
//      */
//     @NotNull
//     String getSourceText();
// 
//     /**
//      * @return  qualified class name for the given test source
//      */
//     @NotNull
//     String getQualifiedClassName();
// }
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/impl/expectation/RunResultExpectationBuilder.java
// @SuppressWarnings("UnusedReturnValue")
// public class RunResultExpectationBuilder {
// 
//     @Nullable private String  expectedExceptionClass;
//     @Nullable private String  expectedExceptionMessageSnippet;
//     @Nullable private String  expectedExceptionMessageText;
//     @Nullable private Integer thrownAtLine;
// 
//     @NotNull
//     public static RunResultExpectationBuilder expectRunResult() {
//         return new RunResultExpectationBuilder();
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder withExceptionClass(@NotNull Class<?> clazz) {
//         return withExceptionClass(clazz.getName());
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder withExceptionClass(@NotNull String clazz) {
//         expectedExceptionClass = clazz;
//         return this;
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder withExceptionMessageSnippet(@NotNull String snippet) {
//         expectedExceptionMessageSnippet = snippet;
//         return this;
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder withExceptionMessage(@NotNull String message) {
//         expectedExceptionMessageText = message;
//         return this;
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder atLine(int line) {
//         thrownAtLine = line;
//         return this;
//     }
// 
//     @NotNull
//     public RunResultExpectation build() {
//         return new RunResultExpectation(expectedExceptionClass,
//                                         expectedExceptionMessageSnippet,
//                                         expectedExceptionMessageText,
//                                         thrownAtLine);
//     }
// }
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/impl/model/TestSourceImpl.java
// public class TestSourceImpl implements TestSource {
// 
//     @NotNull private final String               sourceText;
//     @NotNull private final String               className;
// 
//     public TestSourceImpl(@NotNull String sourceText, @NotNull String className) {
//         this.sourceText = sourceText;
//         this.className = className;
//     }
// 
//     @Override
//     @NotNull
//     public String getSourceText() {
//         return sourceText;
//     }
// 
//     @Override
//     @NotNull
//     public String getQualifiedClassName() {
//         return className;
//     }
// 
//     @Override
//     public String toString() {
//         return className + " source";
//     }
// }
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/util/TestConstants.java
// public static final String CLASS_NAME = "Test";
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/util/TestConstants.java
// public static final String METHOD_NAME = "test";
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/util/TestConstants.java
// public static final String PACKAGE = "tech.harmonysoft.oss.traute.test";


import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import tech.harmonysoft.oss.traute.test.api.model.TestSource;
import tech.harmonysoft.oss.traute.test.impl.expectation.RunResultExpectationBuilder;
import tech.harmonysoft.oss.traute.test.impl.model.TestSourceImpl;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import static java.util.stream.Collectors.joining;
import static org.junit.jupiter.api.Assertions.fail;
import static tech.harmonysoft.oss.traute.test.util.TestConstants.CLASS_NAME;
import static tech.harmonysoft.oss.traute.test.util.TestConstants.METHOD_NAME;
import static tech.harmonysoft.oss.traute.test.util.TestConstants.PACKAGE;
package tech.harmonysoft.oss.traute.test.util;




public class TestUtil {

    public static final String PARAMETER_TEST_CLASS_TEMPLATE =
            "package %s;\n" +
            "%s\n" +
            "public class " + CLASS_NAME + " {\n" +
            "\n" +
            "%s\n" +
            "\n" +
            "  public static void main(String[] args) {\n" +
            "    new " + CLASS_NAME + "()." + METHOD_NAME + "(%s);\n" +
            "  }\n" +
            "}";

    public static final String METHOD_TEST_CLASS_TEMPLATE = String.format(
            "package %s;\n" +
            "\n" +
            "public class %s {\n" +
            "\n" +
            "  @%%s\n" +
            "  public Integer test() {\n" +
            "    %%s\n" +
            "  }\n" +
            "\n" +
            "  private Integer count() {\n" +
            "      return null;\n" +
            "  }\n" +
            "\n" +
            "  public static void main(String[] args) {\n" +
            "    new Test().test();\n" +
            "  }\n" +
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/api/model/TestSource.java
// public interface TestSource {
// 
//     /**
//      * @return  complete test source
//      */
//     @NotNull
//     String getSourceText();
// 
//     /**
//      * @return  qualified class name for the given test source
//      */
//     @NotNull
//     String getQualifiedClassName();
// }
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/impl/expectation/RunResultExpectationBuilder.java
// @SuppressWarnings("UnusedReturnValue")
// public class RunResultExpectationBuilder {
// 
//     @Nullable private String  expectedExceptionClass;
//     @Nullable private String  expectedExceptionMessageSnippet;
//     @Nullable private String  expectedExceptionMessageText;
//     @Nullable private Integer thrownAtLine;
// 
//     @NotNull
//     public static RunResultExpectationBuilder expectRunResult() {
//         return new RunResultExpectationBuilder();
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder withExceptionClass(@NotNull Class<?> clazz) {
//         return withExceptionClass(clazz.getName());
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder withExceptionClass(@NotNull String clazz) {
//         expectedExceptionClass = clazz;
//         return this;
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder withExceptionMessageSnippet(@NotNull String snippet) {
//         expectedExceptionMessageSnippet = snippet;
//         return this;
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder withExceptionMessage(@NotNull String message) {
//         expectedExceptionMessageText = message;
//         return this;
//     }
// 
//     @NotNull
//     public RunResultExpectationBuilder atLine(int line) {
//         thrownAtLine = line;
//         return this;
//     }
// 
//     @NotNull
//     public RunResultExpectation build() {
//         return new RunResultExpectation(expectedExceptionClass,
//                                         expectedExceptionMessageSnippet,
//                                         expectedExceptionMessageText,
//                                         thrownAtLine);
//     }
// }
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/impl/model/TestSourceImpl.java
// public class TestSourceImpl implements TestSource {
// 
//     @NotNull private final String               sourceText;
//     @NotNull private final String               className;
// 
//     public TestSourceImpl(@NotNull String sourceText, @NotNull String className) {
//         this.sourceText = sourceText;
//         this.className = className;
//     }
// 
//     @Override
//     @NotNull
//     public String getSourceText() {
//         return sourceText;
//     }
// 
//     @Override
//     @NotNull
//     public String getQualifiedClassName() {
//         return className;
//     }
// 
//     @Override
//     public String toString() {
//         return className + " source";
//     }
// }
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/util/TestConstants.java
// public static final String CLASS_NAME = "Test";
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/util/TestConstants.java
// public static final String METHOD_NAME = "test";
// 
// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/util/TestConstants.java
// public static final String PACKAGE = "tech.harmonysoft.oss.traute.test";


// Path: core/test/src/test/java/tech/harmonysoft/oss/traute/test/util/TestUtil.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import tech.harmonysoft.oss.traute.test.api.model.TestSource;
import tech.harmonysoft.oss.traute.test.impl.expectation.RunResultExpectationBuilder;
import tech.harmonysoft.oss.traute.test.impl.model.TestSourceImpl;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import static java.util.stream.Collectors.joining;
import static org.junit.jupiter.api.Assertions.fail;
import static tech.harmonysoft.oss.traute.test.util.TestConstants.CLASS_NAME;
import static tech.harmonysoft.oss.traute.test.util.TestConstants.METHOD_NAME;
import static tech.harmonysoft.oss.traute.test.util.TestConstants.PACKAGE;

package tech.harmonysoft.oss.traute.test.util;




public class TestUtil {

    public static final String PARAMETER_TEST_CLASS_TEMPLATE =
            "package %s;\n" +
            "%s\n" +
            "public class " + CLASS_NAME + " {\n" +
            "\n" +
            "%s\n" +
            "\n" +
            "  public static void main(String[] args) {\n" +
            "    new " + CLASS_NAME + "()." + METHOD_NAME + "(%s);\n" +
            "  }\n" +
            "}";

    public static final String METHOD_TEST_CLASS_TEMPLATE = String.format(
            "package %s;\n" +
            "\n" +
            "public class %s {\n" +
            "\n" +
            "  @%%s\n" +
            "  public Integer test() {\n" +
            "    %%s\n" +
            "  }\n" +
            "\n" +
            "  private Integer count() {\n" +
            "      return null;\n" +
            "  }\n" +
            "\n" +
            "  public static void main(String[] args) {\n" +
            "    new Test().test();\n" +
            "  }\n" +
            "}", PACKAGE, CLASS_NAME);