diff --git a/.github/workflows/quality-pipeline.yaml b/.github/workflows/quality-pipeline.yaml index 49ed8e5..6274070 100644 --- a/.github/workflows/quality-pipeline.yaml +++ b/.github/workflows/quality-pipeline.yaml @@ -14,7 +14,7 @@ jobs: with: java-version: 1.8 - name: Build with Gradle - run: ./gradlew clean ready + run: ./workflows testing - name: Upload coverage to Codecov uses: codecov/codecov-action@v1.0.3 with: diff --git a/.gitignore b/.gitignore index be1dce9..447fc88 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ build/ _build/ .python-version *.iml +out/ diff --git a/.workflows/amend-work-after b/.workflows/amend-work-after new file mode 120000 index 0000000..6c966c7 --- /dev/null +++ b/.workflows/amend-work-after @@ -0,0 +1 @@ +save-work-after \ No newline at end of file diff --git a/.workflows/amend-work-ahead b/.workflows/amend-work-ahead new file mode 120000 index 0000000..403c5ca --- /dev/null +++ b/.workflows/amend-work-ahead @@ -0,0 +1 @@ +save-work-ahead \ No newline at end of file diff --git a/.workflows/save-work-after b/.workflows/save-work-after new file mode 100755 index 0000000..ffeea68 --- /dev/null +++ b/.workflows/save-work-after @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +./workflows testing diff --git a/.workflows/save-work-ahead b/.workflows/save-work-ahead new file mode 100755 index 0000000..bf1fe8c --- /dev/null +++ b/.workflows/save-work-ahead @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +./workflows formatting diff --git a/README.md b/README.md index 8f890cb..5ceb02f 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,15 @@ Before sending any pull request, please discuss requirements/changes to be imple by creating a new one. ## Development notes +If you will install and use Git via CLI, all required workflows +will be executed automatically. Otherwise, you can do it manually by running `./workflows` script. + +### Code formatting +We use to format the code. Please run +`./gradlew spotlessApply` to call the formatting manually. + ### Code assessment -Run `./gradlew` (or `gradlew.bat`). It will execute unit & integration tests and let you know if everything is working fine. +Run `./gradlew` (or `gradlew.bat`). It will execute unit, integration tests, and formatting verifications. ### Docs review Automatic analysis of documentation changes in not configured. That's why manual validation is required. diff --git a/build.gradle b/build.gradle index 593c675..5a361b2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,49 @@ plugins { id "com.jfrog.bintray" version "1.8.4" apply false + id "com.diffplug.gradle.spotless" version "3.25.0" } ext { GITHUB_URL = "https://github.com/tatools/sunshine" BINTRAY_ORG = "tatools" } +repositories { + mavenLocal() + jcenter() + mavenCentral() +} + +spotless { + apply plugin: 'java' + format 'misc', { + target '**/*.gradle', '**/*.md', '**/.gitignore' + trimTrailingWhitespace() + indentWithSpaces() + endWithNewline() + } + java { + removeUnusedImports() + indentWithSpaces() + trimTrailingWhitespace() + endWithNewline() + + custom 'Lambda fix', { it.replace('} )', '})').replace('} ,', '},') } + + // use standard modifier order (JLS 4.8.7 Modifiers) + // public protected private abstract static final transient volatile synchronized native strictfp + replaceRegex 'Modifier order 1', '^(\\s*)((?:static)|(?:final)|(?:abstract))\\s+((public)|(protected)|(private))\\s', '$1$3 $2 ' + replaceRegex 'Modifier order 2', '^(\\s*)final\\s+static\\s+((public)|(protected)|(private))\\s', '$1$2 static final ' + replaceRegex 'Modifier order 3', '^(\\s*)static\\s+final\\s+((public)|(protected)|(private))\\s', '$1$2 static final ' + replaceRegex 'Modifier order 4', '^(\\s*((public)|(protected)|(private))?\\s*)\\sfinal\\s+static', '$1 static final' + + // remove empty lines before end of block (closing "}") + replaceRegex 'Remove empty lines before end of block', '\\n[\\n]+(\\s*})(?=\\n)', '\n$1' + + } + freshmark { + target '**/*.md' + } +} subprojects { apply plugin: 'java' diff --git a/docs/md/entry-points.md b/docs/md/entry-points.md index 67e0fbf..7240095 100644 --- a/docs/md/entry-points.md +++ b/docs/md/entry-points.md @@ -1,5 +1,5 @@ # Entry points -An entry point is a Java class which is configured for a JAR and will be used when +An entry point is a Java class which is configured for a JAR and will be used when ```bash java -jar my.jar ``` @@ -14,7 +14,7 @@ Sunshine's wrapper: Also, there is a `SunshineSuite` interface with several core implementations which allow seeking and filtering of the classes to be treated as tests. Sunshine uses a string representation of a class -as an input to a filter which uses +as an input to a filter which uses [Java pattern matching](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html) to filter classes. For instance, there is a `LoginTest` class in `com.example.mypackage` package. It will be converted to `com.example.mypackage.LoginTest` and then put to a filter. @@ -45,7 +45,7 @@ The class exposes the following behavior: 2. `java -Dtests-regex="^(com.company.smoke)(.+)" -jar my.jar` does the same as the previous one except a class name has to match with `^(com.company.smoke)(.+)` regex. 3. `java -jar my.jar testng.xml` runs tests defined in `testng.xml` file (it can be either -[TestNG XML](http://testng.org/doc/documentation-main.html#testng-xml) or +[TestNG XML](http://testng.org/doc/documentation-main.html#testng-xml) or [TestNG YAML](http://testng.org/doc/documentation-main.html#yaml)). @@ -91,7 +91,7 @@ new Sun( ``` ### Specify classes directly -There are some classes which have to be treat as a test suite. +There are some classes which have to be treat as a test suite. TestNG sample ```java diff --git a/docs/md/getting-started.md b/docs/md/getting-started.md index 22fc219..49d7ea6 100644 --- a/docs/md/getting-started.md +++ b/docs/md/getting-started.md @@ -8,8 +8,8 @@ Suppose, there is a Maven project with automated tests ├── README.md ├── pom.xml └── src -    ├── main -    └── test +   ├── main +   └── test ``` Usually, the code is located under `src/main` directory and automated tests under `src/test`. According to [Sunshine's concept](concept.md), the code and automated tests have to live together in `src/main`. @@ -34,5 +34,5 @@ of the configuration, [a JAR's entry point](https://docs.oracle.com/javase/tutor has to be defined. There are predefined classes to be used as the entry points for each test runner. However, -Sunshine was designed to encourage you to create your own configurations based on the project's requirements. +Sunshine was designed to encourage you to create your own configurations based on the project's requirements. Please visit [entry points page](entry-points.md) to find out more. diff --git a/sunshine-core-deps/src/main/java/org/tatools/testng/DisabledTest.java b/sunshine-core-deps/src/main/java/org/tatools/testng/DisabledTest.java index f4646bd..b96858a 100644 --- a/sunshine-core-deps/src/main/java/org/tatools/testng/DisabledTest.java +++ b/sunshine-core-deps/src/main/java/org/tatools/testng/DisabledTest.java @@ -1,10 +1,8 @@ package org.tatools.testng; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ * @since 0.1 */ -public class DisabledTest { -} +public class DisabledTest {} diff --git a/sunshine-core-deps/src/main/java/org/tatools/testng/FailedTest.java b/sunshine-core-deps/src/main/java/org/tatools/testng/FailedTest.java index 4d985ce..0069074 100644 --- a/sunshine-core-deps/src/main/java/org/tatools/testng/FailedTest.java +++ b/sunshine-core-deps/src/main/java/org/tatools/testng/FailedTest.java @@ -1,10 +1,8 @@ package org.tatools.testng; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ * @since 0.1 */ -public class FailedTest { -} +public class FailedTest {} diff --git a/sunshine-core-deps/src/main/java/org/tatools/testng/PassedTest.java b/sunshine-core-deps/src/main/java/org/tatools/testng/PassedTest.java index c001536..ac0eac0 100644 --- a/sunshine-core-deps/src/main/java/org/tatools/testng/PassedTest.java +++ b/sunshine-core-deps/src/main/java/org/tatools/testng/PassedTest.java @@ -1,10 +1,8 @@ package org.tatools.testng; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ * @since 0.1 */ -public class PassedTest { -} +public class PassedTest {} diff --git a/sunshine-core-deps/src/main/java/org/tatools/testng/SkippedTest.java b/sunshine-core-deps/src/main/java/org/tatools/testng/SkippedTest.java index 7e115c8..62243ca 100644 --- a/sunshine-core-deps/src/main/java/org/tatools/testng/SkippedTest.java +++ b/sunshine-core-deps/src/main/java/org/tatools/testng/SkippedTest.java @@ -1,10 +1,8 @@ package org.tatools.testng; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ * @since 0.1 */ -public class SkippedTest { -} +public class SkippedTest {} diff --git a/sunshine-core-deps/src/main/java/org/tatools/testng/Test1.java b/sunshine-core-deps/src/main/java/org/tatools/testng/Test1.java index d4bafc3..c7760ff 100644 --- a/sunshine-core-deps/src/main/java/org/tatools/testng/Test1.java +++ b/sunshine-core-deps/src/main/java/org/tatools/testng/Test1.java @@ -7,5 +7,4 @@ * @version $Id$ * @since 0.1 */ -public class Test1 { -} +public class Test1 {} diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/CompositeStatus.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/CompositeStatus.java index daaba17..d8a3a93 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/CompositeStatus.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/CompositeStatus.java @@ -23,9 +23,10 @@ public CompositeStatus(List statuses) { /** * Returns the exit code of an execution provided by xunit tests runner. - *

- * The code will be a maximum value from all available codes expect zero ones. If there is no - * maximal value, 0 is given (means all are passed), otherwise, a non-zero number (if there is at least one failure). + * + *

The code will be a maximum value from all available codes expect zero ones. If there is no + * maximal value, 0 is given (means all are passed), otherwise, a non-zero number (if there is + * at least one failure). * * @return a calculated exit code */ diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/Directory.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/Directory.java index 1a6b16e..a09f635 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/Directory.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/Directory.java @@ -27,14 +27,10 @@ public Fake(Path path, boolean exist) { } @Override - public void create() { - - } + public void create() {} @Override - public void remove() { - - } + public void remove() {} @Override public Path path() { diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryBase.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryBase.java index 0f833cf..8b1a8cf 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryBase.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryBase.java @@ -1,12 +1,11 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.io.IOException; import java.nio.file.FileVisitOption; import java.nio.file.Files; import java.nio.file.Path; import java.util.Comparator; +import lombok.EqualsAndHashCode; /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectorySafe.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectorySafe.java index f7f52f5..c78cf10 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectorySafe.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectorySafe.java @@ -1,13 +1,12 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.io.IOException; import java.nio.file.Path; +import lombok.EqualsAndHashCode; /** - * The class allows communicating with a {@link Directory} object safely. This means it does not touch real file system - * until it's really needed. + * The class allows communicating with a {@link Directory} object safely. This means it does not + * touch real file system until it's really needed. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryWithAutomaticDeletion.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryWithAutomaticDeletion.java index fb85fae..696ffde 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryWithAutomaticDeletion.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryWithAutomaticDeletion.java @@ -1,6 +1,5 @@ package org.tatools.sunshine.core; - import java.io.IOException; import java.nio.file.Path; @@ -19,16 +18,18 @@ public DirectoryWithAutomaticDeletion(Directory directory) { @Override public final void create() throws IOException { - Runtime.getRuntime().addShutdownHook(new Thread("ds") { - @Override - public void run() { - try { - directory.remove(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - }); + Runtime.getRuntime() + .addShutdownHook( + new Thread("ds") { + @Override + public void run() { + try { + directory.remove(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }); directory.create(); } diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileBase.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileBase.java index c14096a..df4008f 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileBase.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileBase.java @@ -1,10 +1,9 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import lombok.EqualsAndHashCode; /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java index efe96f5..6b6d1b8 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java @@ -12,7 +12,8 @@ */ public interface FileSystem { /** - * Returns a list of files within given file system. An implementation may support recursive search or not. + * Returns a list of files within given file system. An implementation may support recursive + * search or not. * * @return a list of files * @throws FileSystemException if some error occurs diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemException.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemException.java index 08a83c2..d175a6b 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemException.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemException.java @@ -1,8 +1,8 @@ package org.tatools.sunshine.core; /** - * The {@link FileSystemException} class is a default exception to handle errors which may occur in the implementations of - * a {@link FileSystem} interface. + * The {@link FileSystemException} class is a default exception to handle errors which may occur in + * the implementations of a {@link FileSystem} interface. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemFiltered.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemFiltered.java index b0282fb..f14c4b1 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemFiltered.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemFiltered.java @@ -1,9 +1,8 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.util.List; import java.util.stream.Collectors; +import lombok.EqualsAndHashCode; /** * The {@link FileSystemFiltered} class allows to filter files by given condition. diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfClasses.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfClasses.java index 9cebb29..87a5e65 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfClasses.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfClasses.java @@ -1,8 +1,7 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.util.List; +import lombok.EqualsAndHashCode; /** * The {@link FileSystemOfClasses} class allows to select only Java classes. @@ -17,12 +16,13 @@ final class FileSystemOfClasses implements FileSystem { private final FileSystem fileSystem; FileSystemOfClasses(FileSystem fileSystem) { - this.fileSystem = new FileSystemFiltered( - new FileSystemOfFileSystems( - fileSystem, - new FileSystemOfJarFiles(new FileSystemFiltered(fileSystem, new JarCondition())) - ), new ClassCondition() - ); + this.fileSystem = + new FileSystemFiltered( + new FileSystemOfFileSystems( + fileSystem, + new FileSystemOfJarFiles( + new FileSystemFiltered(fileSystem, new JarCondition()))), + new ClassCondition()); } @Override @@ -37,7 +37,6 @@ public boolean applicable(String identity) { } } - private final class JarCondition implements Condition { @Override public boolean applicable(String identity) { diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfClasspathClasses.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfClasspathClasses.java index 087a807..94e6206 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfClasspathClasses.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfClasspathClasses.java @@ -1,15 +1,14 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.io.File; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import lombok.EqualsAndHashCode; /** - * The {@link FileSystemOfClasspathClasses} class provides an implementation of {@link FileSystem} interface - * which allows to find all Java classes in current Java CLASSPATH. + * The {@link FileSystemOfClasspathClasses} class provides an implementation of {@link FileSystem} + * interface which allows to find all Java classes in current Java CLASSPATH. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -24,18 +23,17 @@ public FileSystemOfClasspathClasses() { this( new FileSystemOfClasses( new FileSystemOfFileSystems( - Arrays.stream(System.getProperty("java.class.path").split(File.pathSeparator)) - .map(FileSystemOfPath::new).collect(Collectors.toList()) - ) - ) - ); + Arrays.stream( + System.getProperty("java.class.path") + .split(File.pathSeparator)) + .map(FileSystemOfPath::new) + .collect(Collectors.toList())))); } private FileSystemOfClasspathClasses(FileSystem fileSystem) { this.fileSystem = fileSystem; } - @Override public final List files() throws FileSystemException { return fileSystem.files(); diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfFileSystems.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfFileSystems.java index cc50d8c..c30a030 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfFileSystems.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfFileSystems.java @@ -1,13 +1,12 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.util.ArrayList; import java.util.List; +import lombok.EqualsAndHashCode; /** - * The {@link FileSystemOfFileSystems} class allows to represent several fileSystems as an instance of - * {@link FileSystem} interface. + * The {@link FileSystemOfFileSystems} class allows to represent several fileSystems as an instance + * of {@link FileSystem} interface. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -19,7 +18,7 @@ final class FileSystemOfFileSystems implements FileSystem { private final FileSystem[] fileSystems; FileSystemOfFileSystems(List fileSystems) { - this(fileSystems.toArray(new FileSystem[]{})); + this(fileSystems.toArray(new FileSystem[] {})); } FileSystemOfFileSystems(FileSystem... fileSystems) { diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfJarFile.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfJarFile.java index e30cd30..93a9b6e 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfJarFile.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfJarFile.java @@ -1,13 +1,12 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import lombok.EqualsAndHashCode; /** * The {@link FileSystemOfJarFile} class allows to search files in given jar file. diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfJarFiles.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfJarFiles.java index 32b055a..ce639f9 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfJarFiles.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfJarFiles.java @@ -1,13 +1,13 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.util.List; import java.util.stream.Collectors; +import lombok.EqualsAndHashCode; /** - * The {@link FileSystemOfJarFiles} class allows to convert a file system with JARs only to a file system with files. - * Basically, it unzips files from the JARs and represents them as a separate file system. + * The {@link FileSystemOfJarFiles} class allows to convert a file system with JARs only to a file + * system with files. Basically, it unzips files from the JARs and represents them as a separate + * file system. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -20,7 +20,12 @@ final class FileSystemOfJarFiles implements FileSystem { private final Mapping mapping; FileSystemOfJarFiles(FileSystem fileSystem) { - this(fileSystem, fs -> fs.files().stream().map(FileSystemOfJarFile::new).collect(Collectors.toList())); + this( + fileSystem, + fs -> + fs.files().stream() + .map(FileSystemOfJarFile::new) + .collect(Collectors.toList())); } private FileSystemOfJarFiles(FileSystem fileSystem, Mapping mapping) { @@ -33,7 +38,6 @@ public List files() throws FileSystemException { return new FileSystemOfFileSystems(mapping.objects(fileSystem)).files(); } - @FunctionalInterface private interface Mapping { List objects(FileSystem fileSystem) throws FileSystemException; diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfPath.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfPath.java index 79e1102..87a0d31 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfPath.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemOfPath.java @@ -1,7 +1,5 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; @@ -10,6 +8,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.List; +import lombok.EqualsAndHashCode; /** * The {@link FileSystemOfPath} class allows to search files by given path. @@ -34,29 +33,32 @@ final class FileSystemOfPath implements FileSystem { public List files() throws FileSystemException { try { List files = new ArrayList<>(); - Files.walkFileTree(path, new FileVisitor() { - @Override - public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { - files.add(new FileSystemPathRelative(path, dir.toString())); - return FileVisitResult.CONTINUE; - } + Files.walkFileTree( + path, + new FileVisitor() { + @Override + public FileVisitResult preVisitDirectory( + Path dir, BasicFileAttributes attrs) { + files.add(new FileSystemPathRelative(path, dir.toString())); + return FileVisitResult.CONTINUE; + } - @Override - public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { - files.add(new FileSystemPathRelative(path, file.toString())); - return FileVisitResult.CONTINUE; - } + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { + files.add(new FileSystemPathRelative(path, file.toString())); + return FileVisitResult.CONTINUE; + } - @Override - public FileVisitResult visitFileFailed(Path file, IOException exc) { - return FileVisitResult.CONTINUE; - } + @Override + public FileVisitResult visitFileFailed(Path file, IOException exc) { + return FileVisitResult.CONTINUE; + } - @Override - public FileVisitResult postVisitDirectory(Path dir, IOException exc) { - return FileVisitResult.CONTINUE; - } - }); + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) { + return FileVisitResult.CONTINUE; + } + }); return files; } catch (IOException e) { throw new FileSystemException(e); diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathBase.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathBase.java index bd9b955..1aec0fb 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathBase.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathBase.java @@ -1,11 +1,10 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; -import lombok.ToString; - import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import lombok.EqualsAndHashCode; +import lombok.ToString; /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathRelative.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathRelative.java index 904f6ba..1d758f7 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathRelative.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathRelative.java @@ -1,10 +1,9 @@ package org.tatools.sunshine.core; +import java.nio.file.Path; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.nio.file.Path; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -37,6 +36,7 @@ public final Path path() { @Override public final boolean exist() { - throw new UnsupportedOperationException("Can't say definitely about existence of a path: " + path()); + throw new UnsupportedOperationException( + "Can't say definitely about existence of a path: " + path()); } } diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/Kernel.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/Kernel.java index ead1d98..dc14856 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/Kernel.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/Kernel.java @@ -46,7 +46,7 @@ public Fake(Status status) { /** * Constructs a new object. * - * @param status a status of the execution + * @param status a status of the execution * @param availableListeners a list which will store all listeners */ public Fake(Status status, List availableListeners) { @@ -62,10 +62,7 @@ public Status status() { @Override public Kernel with(Object... objects) { this.listeners.addAll(Arrays.asList(objects)); - return new Fake( - this.result, - this.listeners - ); + return new Fake(this.result, this.listeners); } } } diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java index d64ecf6..53b5976 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java @@ -1,8 +1,8 @@ package org.tatools.sunshine.core; /** - * The {@link KernelException} class is a default exception to handle errors which may occur in the implementations of - * an {@link Kernel}. + * The {@link KernelException} class is a default exception to handle errors which may occur in the + * implementations of an {@link Kernel}. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java index b34a92d..499ac5f 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java @@ -1,8 +1,7 @@ package org.tatools.sunshine.core; -import lombok.EqualsAndHashCode; - import java.util.regex.Pattern; +import lombok.EqualsAndHashCode; /** * The implementation provides an ability to use a regex pattern for analyzing an identity. @@ -17,8 +16,8 @@ public class RegexCondition implements Condition { final Pattern regex; /** - * Use a value of "tests-regex" system property as a regex pattern. If the system property is not set, - * the "(.+)(Test)([\w\d]+)?" value is used. + * Use a value of "tests-regex" system property as a regex pattern. If the system property is + * not set, the "(.+)(Test)([\w\d]+)?" value is used. */ public RegexCondition() { this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?")); diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/SequentialExecution.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/SequentialExecution.java index 9ec2cca..0b867f6 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/SequentialExecution.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/SequentialExecution.java @@ -38,7 +38,6 @@ public Kernel with(Listener... listeners) { return new SequentialExecution<>( this.elements.stream() .map(listenerKernel -> listenerKernel.with(listeners)) - .collect(Collectors.toList()) - ); + .collect(Collectors.toList())); } } diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/Star.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/Star.java index a31eced..9953acd 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/Star.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/Star.java @@ -1,9 +1,11 @@ package org.tatools.sunshine.core; /** - * The {@link Star} interface provides a contract to use {@link Kernel}s. The root idea is that a {@link Star} can - * shine only it has a {@link Kernel}. And a {@link Kernel} is always a part of a {@link Star}. - *

The interface is a top level abstraction of the Sunshine.

+ * The {@link Star} interface provides a contract to use {@link Kernel}s. The root idea is that a + * {@link Star} can shine only it has a {@link Kernel}. And a {@link Kernel} is always a part of a + * {@link Star}. + * + *

The interface is a top level abstraction of the Sunshine. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -12,8 +14,6 @@ */ @FunctionalInterface public interface Star { - /** - * Allows this star to shine with an encapsulated {@link Kernel}(s). - */ + /** Allows this star to shine with an encapsulated {@link Kernel}(s). */ void shine(); } diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/Suite.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/Suite.java index c705d5e..618be94 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/Suite.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/Suite.java @@ -1,6 +1,5 @@ package org.tatools.sunshine.core; - /** * The interface represents some tests. * diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java index 58a3e8c..42ae845 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java @@ -1,8 +1,8 @@ package org.tatools.sunshine.core; /** - * The {@link SuiteException} class is a default exception to handle errors which may occur in the implementations of - * a {@link Suite}. + * The {@link SuiteException} class is a default exception to handle errors which may occur in the + * implementations of a {@link Suite}. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteFromFileSystem.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteFromFileSystem.java index f4b702c..bc8b19e 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteFromFileSystem.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteFromFileSystem.java @@ -1,11 +1,11 @@ package org.tatools.sunshine.core; - import java.util.List; import java.util.stream.Collectors; /** - * The class represents a suite of {@link SunshineTest}s which will be loaded based on given file system. + * The class represents a suite of {@link SunshineTest}s which will be loaded based on given file + * system. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -16,8 +16,8 @@ public class SuiteFromFileSystem implements SunshineSuite { /** * Construct the new instance. * - * @param fileSystem a file system to build a suite. Each item (path) will be represented - * by a separate {@link SunshineTest}. + * @param fileSystem a file system to build a suite. Each item (path) will be represented by a + * separate {@link SunshineTest}. */ public SuiteFromFileSystem(FileSystem fileSystem) { this.fileSystem = fileSystem; diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java index 40a97e0..953124c 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java @@ -1,8 +1,9 @@ package org.tatools.sunshine.core; /** - * The {@link Sun} class provides an implementation of a {@link Star} especially designed for continuous integration - * servers. If any errors occur during tests execution, a continuous integration server will fail the job's execution. + * The {@link Sun} class provides an implementation of a {@link Star} especially designed for + * continuous integration servers. If any errors occur during tests execution, a continuous + * integration server will fail the job's execution. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -23,9 +24,9 @@ public Sun(Kernel kernel) { } /** - * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in suite's preparation, the - * execution will be aborted with exit code #{@value SUNSHINE_ERROR}, otherwise exit code will be provided by - * appropriate {@link Kernel}. + * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in + * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR}, + * otherwise exit code will be provided by appropriate {@link Kernel}. */ @Override public final void shine() { @@ -39,8 +40,7 @@ public final void shine() { .append(status.failureCount()) .append(", Skips: ") .append(status.ignoreCount()) - .append("\n===============================================\n") - ); + .append("\n===============================================\n")); System.exit(status.code()); } catch (KernelException e) { e.printStackTrace(System.out); diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/SunshineSuiteFilterable.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/SunshineSuiteFilterable.java index 71e8896..8df6479 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/SunshineSuiteFilterable.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/SunshineSuiteFilterable.java @@ -20,6 +20,8 @@ public SunshineSuiteFilterable(SunshineSuite suite, Condition filter) { @Override public final List tests() throws SuiteException { - return suite.tests().stream().filter(classTest -> classTest.match(filter)).collect(Collectors.toList()); + return suite.tests().stream() + .filter(classTest -> classTest.match(filter)) + .collect(Collectors.toList()); } } diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/SunshineSuitePrintable.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/SunshineSuitePrintable.java index 33258e6..891ccf6 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/SunshineSuitePrintable.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/SunshineSuitePrintable.java @@ -21,7 +21,8 @@ public final List tests() throws SuiteException { final StringBuilder message = new StringBuilder(); message.append("Sunshine found ") .append(tests.size()) - .append(" classes by the specified pattern. They all will be passed to appropriate xUnit engine.") + .append( + " classes by the specified pattern. They all will be passed to appropriate xUnit engine.") .append("\nClasses:"); tests.forEach(c -> message.append("\n- ").append(c)); System.out.println(message); diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/TestException.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/TestException.java index 887199e..526c383 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/TestException.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/TestException.java @@ -1,8 +1,8 @@ package org.tatools.sunshine.core; /** - * The {@link TestException} class is a default exception to handle errors which may occur in the implementations of - * a {@link Test} interface. + * The {@link TestException} class is a default exception to handle errors which may occur in the + * implementations of a {@link Test} interface. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/TestFromFile.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/TestFromFile.java index 8cdf59c..272d58e 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/TestFromFile.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/TestFromFile.java @@ -15,8 +15,9 @@ public class TestFromFile implements SunshineTest { /** * Construct the new instance. * - * @param path is a relative path in a file system which includes class name (like {@code org/my/tests/Test1}). - * It has to be relative to current classpath. It can have {@code .class} extension or not. + * @param path is a relative path in a file system which includes class name (like {@code + * org/my/tests/Test1}). It has to be relative to current classpath. It can have {@code + * .class} extension or not. */ public TestFromFile(String path) { this.path = path; diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java index 5d9d716..53346cf 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java @@ -4,8 +4,8 @@ import java.util.Arrays; /** - * The implementation allows printing of encapsulated condition to the standard output. The printing will happen only - * once before the first usage of {@link #applicable(String)}. + * The implementation allows printing of encapsulated condition to the standard output. The printing + * will happen only once before the first usage of {@link #applicable(String)}. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -14,7 +14,7 @@ public class VerboseRegex implements Condition { private final RegexCondition regexCondition; - private final boolean[] say = new boolean[]{true}; + private final boolean[] say = new boolean[] {true}; private final PrintStream printer; /** @@ -30,7 +30,7 @@ public VerboseRegex(RegexCondition condition) { * Construct the object. * * @param regexCondition the condition - * @param printer a print stream + * @param printer a print stream */ VerboseRegex(RegexCondition regexCondition, PrintStream printer) { this.regexCondition = regexCondition; @@ -43,9 +43,7 @@ public final boolean applicable(String identity) { this.printer.println( String.format( "The following pattern will be used for classes filtering: %s", - this.regexCondition.regex.pattern() - ) - ); + this.regexCondition.regex.pattern())); Arrays.fill(say, false); } return this.regexCondition.applicable(identity); diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/CompositeStatusTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/CompositeStatusTest.java index 1177ea2..b1502cb 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/CompositeStatusTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/CompositeStatusTest.java @@ -1,11 +1,10 @@ package org.tatools.sunshine.core; +import java.util.Arrays; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; -import java.util.Arrays; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -16,57 +15,61 @@ public class CompositeStatusTest { public void testZeroCode() { MatcherAssert.assertThat( new CompositeStatus(Arrays.asList(new Status.Fake(), new Status.Fake())).code(), - Matchers.is((short) 0) - ); + Matchers.is((short) 0)); } @Test public void testNonZeroPositiveCode() { MatcherAssert.assertThat( - new CompositeStatus(Arrays.asList( - new Status.Fake((short) 3, 0, 1, 1), new Status.Fake((short) 2, 0, 1, 1) - )).code(), - Matchers.is((short) 3) - ); + new CompositeStatus( + Arrays.asList( + new Status.Fake((short) 3, 0, 1, 1), + new Status.Fake((short) 2, 0, 1, 1))) + .code(), + Matchers.is((short) 3)); } @Test public void testNonZeroNegativeCode() { MatcherAssert.assertThat( - new CompositeStatus(Arrays.asList( - new Status.Fake((short) -3, 0, 1, 1), new Status.Fake((short) 0, 0, 1, 1) - )).code(), - Matchers.is((short) -3) - ); + new CompositeStatus( + Arrays.asList( + new Status.Fake((short) -3, 0, 1, 1), + new Status.Fake((short) 0, 0, 1, 1))) + .code(), + Matchers.is((short) -3)); } @Test public void testSumOfRunCount() { MatcherAssert.assertThat( - new CompositeStatus(Arrays.asList( - new Status.Fake((short) 3, 1, 2, 3), new Status.Fake((short) 2, 4, 5, 6) - )).runCount(), - Matchers.is(5) - ); + new CompositeStatus( + Arrays.asList( + new Status.Fake((short) 3, 1, 2, 3), + new Status.Fake((short) 2, 4, 5, 6))) + .runCount(), + Matchers.is(5)); } @Test public void testSumOfFailureCount() { MatcherAssert.assertThat( - new CompositeStatus(Arrays.asList( - new Status.Fake((short) 3, 1, 2, 3), new Status.Fake((short) 2, 4, 5, 6) - )).failureCount(), - Matchers.is(7) - ); + new CompositeStatus( + Arrays.asList( + new Status.Fake((short) 3, 1, 2, 3), + new Status.Fake((short) 2, 4, 5, 6))) + .failureCount(), + Matchers.is(7)); } @Test public void testSumOfIgnoreCount() { MatcherAssert.assertThat( - new CompositeStatus(Arrays.asList( - new Status.Fake((short) 3, 1, 2, 3), new Status.Fake((short) 2, 4, 5, 6) - )).ignoreCount(), - Matchers.is(9) - ); + new CompositeStatus( + Arrays.asList( + new Status.Fake((short) 3, 1, 2, 3), + new Status.Fake((short) 2, 4, 5, 6))) + .ignoreCount(), + Matchers.is(9)); } } diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryBaseTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryBaseTest.java index f9fb67a..17ffe2b 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryBaseTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryBaseTest.java @@ -1,14 +1,13 @@ package org.tatools.sunshine.core; +import java.io.IOException; +import java.nio.file.Paths; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import java.io.IOException; -import java.nio.file.Paths; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -16,12 +15,12 @@ */ public class DirectoryBaseTest { - @Rule - public TemporaryFolder testFolder = new TemporaryFolder(); + @Rule public TemporaryFolder testFolder = new TemporaryFolder(); @Test public void create() throws IOException { - final FileSystemPathBase path = new FileSystemPathBase(testFolder.getRoot().getAbsolutePath(), "a"); + final FileSystemPathBase path = + new FileSystemPathBase(testFolder.getRoot().getAbsolutePath(), "a"); new DirectoryBase(path).create(); MatcherAssert.assertThat("The directory wasn't created", path.exist()); } @@ -38,16 +37,13 @@ public void remove() throws IOException { public void exist() { MatcherAssert.assertThat( "The directory isn't present", - new DirectoryBase(new FileSystemPathBase(testFolder.getRoot().getAbsolutePath())).exist() - ); + new DirectoryBase(new FileSystemPathBase(testFolder.getRoot().getAbsolutePath())) + .exist()); } @Test public void path() { final String path = "a"; - MatcherAssert.assertThat( - new DirectoryBase(path).path(), - Matchers.equalTo(Paths.get(path)) - ); + MatcherAssert.assertThat(new DirectoryBase(path).path(), Matchers.equalTo(Paths.get(path))); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryWithAutomaticCreationTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryWithAutomaticCreationTest.java index b69aac0..716a574 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryWithAutomaticCreationTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryWithAutomaticCreationTest.java @@ -1,25 +1,23 @@ package org.tatools.sunshine.core; - +import java.io.IOException; import org.hamcrest.MatcherAssert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import java.io.IOException; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ * @since 0.1 */ public class DirectoryWithAutomaticCreationTest { - @Rule - public TemporaryFolder testFolder = new TemporaryFolder(); + @Rule public TemporaryFolder testFolder = new TemporaryFolder(); @Test public void create() throws IOException { - final FileSystemPathBase path = new FileSystemPathBase(testFolder.newFolder().toString(), "a"); + final FileSystemPathBase path = + new FileSystemPathBase(testFolder.newFolder().toString(), "a"); new DirectoryWithAutomaticCreation(new DirectoryBase(path)).create(); MatcherAssert.assertThat("The directory wasn't created", path.exist()); } @@ -33,15 +31,17 @@ public void remove() throws IOException { @Test public void exist() throws IOException { - final FileSystemPathBase path = new FileSystemPathBase(testFolder.newFolder().toString(), "a"); + final FileSystemPathBase path = + new FileSystemPathBase(testFolder.newFolder().toString(), "a"); new DirectoryWithAutomaticCreation(new DirectoryBase(path)).exist(); MatcherAssert.assertThat("The directory wasn't created", path.exist()); } @Test public void path() throws IOException { - final FileSystemPathBase path = new FileSystemPathBase(testFolder.newFolder().toString(), "a"); + final FileSystemPathBase path = + new FileSystemPathBase(testFolder.newFolder().toString(), "a"); new DirectoryWithAutomaticCreation(new DirectoryBase(path)).path(); MatcherAssert.assertThat("The directory wasn't created", path.exist()); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryWithAutomaticDeletionTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryWithAutomaticDeletionTest.java index 4c82d1a..ddf030c 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryWithAutomaticDeletionTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/DirectoryWithAutomaticDeletionTest.java @@ -1,23 +1,20 @@ package org.tatools.sunshine.core; - +import java.io.IOException; +import java.nio.file.Path; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import java.io.IOException; -import java.nio.file.Path; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ * @since 0.1 */ public class DirectoryWithAutomaticDeletionTest { - @Rule - public TemporaryFolder testFolder = new TemporaryFolder(); + @Rule public TemporaryFolder testFolder = new TemporaryFolder(); @Test public void create() throws IOException { @@ -38,9 +35,8 @@ public void exist() { MatcherAssert.assertThat( "The directory isn't present", new DirectoryWithAutomaticDeletion( - new Directory.Fake(testFolder.getRoot().toPath(), true) - ).exist() - ); + new Directory.Fake(testFolder.getRoot().toPath(), true)) + .exist()); } @Test @@ -48,7 +44,6 @@ public void path() { final Path file = testFolder.getRoot().toPath(); MatcherAssert.assertThat( new DirectoryWithAutomaticDeletion(new Directory.Fake(file)).path(), - Matchers.equalTo(file) - ); + Matchers.equalTo(file)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileBaseTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileBaseTest.java index 01ab0e8..ed13d94 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileBaseTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileBaseTest.java @@ -1,23 +1,20 @@ package org.tatools.sunshine.core; - +import java.io.IOException; +import java.nio.file.Files; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import java.io.IOException; -import java.nio.file.Files; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ * @since 0.1 */ public class FileBaseTest { - @Rule - public TemporaryFolder testFolder = new TemporaryFolder(); + @Rule public TemporaryFolder testFolder = new TemporaryFolder(); @Test public void write() throws IOException { @@ -25,4 +22,4 @@ public void write() throws IOException { file.write("dasd"); MatcherAssert.assertThat(Files.exists(file.path()), Matchers.is(true)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemFilteredTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemFilteredTest.java index cc135d5..d438706 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemFilteredTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemFilteredTest.java @@ -1,11 +1,10 @@ package org.tatools.sunshine.core; +import java.util.Collections; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; -import java.util.Collections; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -16,10 +15,10 @@ public class FileSystemFilteredTest { public void files() throws FileSystemException { MatcherAssert.assertThat( new FileSystemFiltered( - new FileSystem.Fake(Collections.singletonList(new FileSystemPath.Fake())), - new Condition.Fake(false) - ).files(), - Matchers.hasSize(0) - ); + new FileSystem.Fake( + Collections.singletonList(new FileSystemPath.Fake())), + new Condition.Fake(false)) + .files(), + Matchers.hasSize(0)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfClassesTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfClassesTest.java index b6b4881..d9b178f 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfClassesTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfClassesTest.java @@ -1,11 +1,10 @@ package org.tatools.sunshine.core; +import java.util.Arrays; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; -import java.util.Arrays; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -15,23 +14,19 @@ public class FileSystemOfClassesTest { @Test public void onlyFilesInFileSystem() throws FileSystemException { MatcherAssert.assertThat( - new FileSystemOfClasses(new FileSystem.Fake( - Arrays.asList( - new FileSystemPath.Fake("SomeTest.class"), - new FileSystemPath.Fake("some-file.txt") - ) - )).files(), - Matchers.hasSize(1) - ); + new FileSystemOfClasses( + new FileSystem.Fake( + Arrays.asList( + new FileSystemPath.Fake("SomeTest.class"), + new FileSystemPath.Fake("some-file.txt")))) + .files(), + Matchers.hasSize(1)); } @Test public void filesAndJarsInFileSystem() throws FileSystemException { MatcherAssert.assertThat( - new FileSystemOfClasses( - new FileSystemOfJarFile("build/sample-tests.jar") - ).files(), - Matchers.hasSize(5) - ); + new FileSystemOfClasses(new FileSystemOfJarFile("build/sample-tests.jar")).files(), + Matchers.hasSize(5)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfClasspathClassesTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfClasspathClassesTest.java index f9ad07d..f513186 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfClasspathClassesTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfClasspathClassesTest.java @@ -13,6 +13,7 @@ public class FileSystemOfClasspathClassesTest { @Test public void files() throws FileSystemException { - MatcherAssert.assertThat(new FileSystemOfClasspathClasses().files(), Matchers.not(Matchers.empty())); + MatcherAssert.assertThat( + new FileSystemOfClasspathClasses().files(), Matchers.not(Matchers.empty())); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfFileSystemsTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfFileSystemsTest.java index 48f6f89..3e5bad1 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfFileSystemsTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfFileSystemsTest.java @@ -1,12 +1,11 @@ package org.tatools.sunshine.core; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.Test; - import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; +import org.junit.Test; /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) @@ -16,13 +15,11 @@ public class FileSystemOfFileSystemsTest { @Test public void files() throws FileSystemException { - List fileSystems = Arrays.asList( - new FileSystem.Fake(Collections.singletonList(new FileSystemPath.Fake())), - new FileSystem.Fake(Collections.singletonList(new FileSystemPath.Fake())) - ); + List fileSystems = + Arrays.asList( + new FileSystem.Fake(Collections.singletonList(new FileSystemPath.Fake())), + new FileSystem.Fake(Collections.singletonList(new FileSystemPath.Fake()))); MatcherAssert.assertThat( - new FileSystemOfFileSystems(fileSystems).files(), - Matchers.hasSize(2) - ); + new FileSystemOfFileSystems(fileSystems).files(), Matchers.hasSize(2)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfJarFileTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfJarFileTest.java index 78461c9..3c4625a 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfJarFileTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfJarFileTest.java @@ -14,12 +14,11 @@ public class FileSystemOfJarFileTest { public void files() throws FileSystemException { MatcherAssert.assertThat( new FileSystemOfJarFile("build/sample-tests.jar").files(), - Matchers.hasItem(new FileSystemPathBase("org/tatools/testng/Test1.class")) - ); + Matchers.hasItem(new FileSystemPathBase("org/tatools/testng/Test1.class"))); } @Test(expected = FileSystemException.class) public void incorrectPath() throws FileSystemException { new FileSystemOfJarFile("faffasfas").files(); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfJarFilesTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfJarFilesTest.java index eb13d56..0b6234f 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfJarFilesTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfJarFilesTest.java @@ -14,13 +14,10 @@ public class FileSystemOfJarFilesTest { public void files() throws FileSystemException { MatcherAssert.assertThat( new FileSystemOfJarFiles( - new FileSystem.Fake( - new FileSystemPath.Fake("build/sample-tests.jar"), - new FileSystemPath.Fake("build/sample-tests.jar") - ) - ).files(), - Matchers.hasSize(20) - ); + new FileSystem.Fake( + new FileSystemPath.Fake("build/sample-tests.jar"), + new FileSystemPath.Fake("build/sample-tests.jar"))) + .files(), + Matchers.hasSize(20)); } - -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfPathTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfPathTest.java index 45411d4..d68c89e 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfPathTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemOfPathTest.java @@ -5,7 +5,6 @@ import org.hamcrest.Matchers; import org.junit.Test; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -17,12 +16,14 @@ public class FileSystemOfPathTest { @Test public void files() throws FileSystemException { - CustomTypeSafeMatcher matcher = new CustomTypeSafeMatcher("Has at least one item") { - @Override - protected boolean matchesSafely(Integer item) { - return item > 0; - } - }; - MatcherAssert.assertThat(new FileSystemOfPath(RESOURCES).files(), Matchers.hasSize(matcher)); + CustomTypeSafeMatcher matcher = + new CustomTypeSafeMatcher("Has at least one item") { + @Override + protected boolean matchesSafely(Integer item) { + return item > 0; + } + }; + MatcherAssert.assertThat( + new FileSystemOfPath(RESOURCES).files(), Matchers.hasSize(matcher)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemPathBaseTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemPathBaseTest.java index d71d1f3..74f658e 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemPathBaseTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemPathBaseTest.java @@ -1,11 +1,10 @@ package org.tatools.sunshine.core; +import java.nio.file.Paths; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; -import java.nio.file.Paths; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -17,9 +16,7 @@ public class FileSystemPathBaseTest { public void path() { final String path = "aa"; MatcherAssert.assertThat( - new FileSystemPathBase(path).path(), - Matchers.equalTo(Paths.get(path)) - ); + new FileSystemPathBase(path).path(), Matchers.equalTo(Paths.get(path))); } @Test @@ -28,15 +25,15 @@ public void pathWithFolder() { final String file = "file"; MatcherAssert.assertThat( new FileSystemPathBase(directory, file).path(), - Matchers.equalTo(Paths.get(directory + "/" + file)) - ); + Matchers.equalTo(Paths.get(directory + "/" + file))); } @Test public void exist() { MatcherAssert.assertThat( "File is absent", - new FileSystemPathBase("src/main/java/org/tatools/sunshine/core/FileSystemPathBase.java").exist() - ); + new FileSystemPathBase( + "src/main/java/org/tatools/sunshine/core/FileSystemPathBase.java") + .exist()); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemPathRelativeTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemPathRelativeTest.java index bf1d95d..9471330 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemPathRelativeTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/FileSystemPathRelativeTest.java @@ -1,13 +1,12 @@ package org.tatools.sunshine.core; +import java.nio.file.Path; +import java.nio.file.Paths; import org.hamcrest.CustomTypeSafeMatcher; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; -import java.nio.file.Path; -import java.nio.file.Paths; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -19,40 +18,35 @@ public class FileSystemPathRelativeTest { public void asStringForParentWithSlashInTheEnd() { MatcherAssert.assertThat( new FileSystemPathRelative("/a/b/", "/a/b/c").path(), - Matchers.is(new PathMatcher("c")) - ); + Matchers.is(new PathMatcher("c"))); } @Test public void asStringForParentWithoutSlashInTheEnd() { MatcherAssert.assertThat( new FileSystemPathRelative("/a/b", "/a/b/c").path(), - Matchers.is(new PathMatcher("c")) - ); + Matchers.is(new PathMatcher("c"))); } @Test public void asStringWhenParentIsEqualsToFull() { MatcherAssert.assertThat( new FileSystemPathRelative("/a/b/c", "/a/b/c").path(), - Matchers.is(new PathMatcher("/a/b/c")) - ); + Matchers.is(new PathMatcher("/a/b/c"))); } @Test public void asStringForRelativeParentWithSlashInTheEnd() { MatcherAssert.assertThat( new FileSystemPathRelative("a/b/", "a/b/c").path(), - Matchers.is(new PathMatcher("c")) - ); + Matchers.is(new PathMatcher("c"))); } @Test public void asStringForRelativeParentWithoutSlashInTheEnd() { MatcherAssert.assertThat( new FileSystemPathRelative("a/b", "a/b/c").path(), - Matchers.is(new PathMatcher("c")) - ); + Matchers.is(new PathMatcher("c"))); } private final class PathMatcher extends CustomTypeSafeMatcher { @@ -69,4 +63,4 @@ protected boolean matchesSafely(Path item) { return item.equals(Paths.get(expected)); } } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/RegexConditionTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/RegexConditionTest.java index cd6f309..0f6c3f7 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/RegexConditionTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/RegexConditionTest.java @@ -1,13 +1,12 @@ package org.tatools.sunshine.core; +import java.util.Arrays; +import java.util.Collection; import org.hamcrest.MatcherAssert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import java.util.Arrays; -import java.util.Collection; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -24,20 +23,20 @@ public RegexConditionTest(String className) { @Parameterized.Parameters public static Collection data() { - return Arrays.asList(new Object[][]{ - {"io.github.my.FirstTest"}, - {"io.github.my.FirstTest1"}, - {"io.github.my.Test"}, - {"io.github.my.1Test"}, - {"io.github.my.FirstTestDo"}, - }); + return Arrays.asList( + new Object[][] { + {"io.github.my.FirstTest"}, + {"io.github.my.FirstTest1"}, + {"io.github.my.Test"}, + {"io.github.my.1Test"}, + {"io.github.my.FirstTestDo"}, + }); } @Test public void applicable() { MatcherAssert.assertThat( "Regex doesn't work for " + this.className, - new RegexCondition().applicable(this.className) - ); + new RegexCondition().applicable(this.className)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/SequentialExecutionTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/SequentialExecutionTest.java index 2830e6c..e708132 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/SequentialExecutionTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/SequentialExecutionTest.java @@ -1,12 +1,11 @@ package org.tatools.sunshine.core; +import java.util.ArrayList; +import java.util.List; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -17,17 +16,18 @@ public class SequentialExecutionTest { public void testStatus() throws KernelException { MatcherAssert.assertThat( new SequentialExecution( - new Kernel.Fake(new Status.Fake()), - new Kernel.Fake(new Status.Fake((short) 1, 2, 1, 1)) - ).status().code(), - Matchers.is((short) 1) - ); + new Kernel.Fake(new Status.Fake()), + new Kernel.Fake(new Status.Fake((short) 1, 2, 1, 1))) + .status() + .code(), + Matchers.is((short) 1)); } @Test public void testWithListeners() { final List listeners = new ArrayList<>(); - new SequentialExecution(new Kernel.Fake(new Status.Fake(), listeners)).with(new Object()); + new SequentialExecution(new Kernel.Fake(new Status.Fake(), listeners)) + .with(new Object()); MatcherAssert.assertThat(listeners, Matchers.hasSize(1)); } } diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/SuiteFromClassesTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/SuiteFromClassesTest.java index 0550945..c6741c2 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/SuiteFromClassesTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/SuiteFromClassesTest.java @@ -13,8 +13,6 @@ public class SuiteFromClassesTest { @Test public void tests() throws SuiteException { MatcherAssert.assertThat( - new SuiteFromClasses(SuiteFromClasses.class).tests(), - Matchers.hasSize(1) - ); + new SuiteFromClasses(SuiteFromClasses.class).tests(), Matchers.hasSize(1)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/SuiteFromFileSystemTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/SuiteFromFileSystemTest.java index aea67b8..181837c 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/SuiteFromFileSystemTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/SuiteFromFileSystemTest.java @@ -14,7 +14,6 @@ public class SuiteFromFileSystemTest { public void tests() throws SuiteException { MatcherAssert.assertThat( new SuiteFromFileSystem(new FileSystem.Fake(new FileSystemPath.Fake("a"))).tests(), - Matchers.hasSize(1) - ); + Matchers.hasSize(1)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/SunTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/SunTest.java index cd4824c..aeaa266 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/SunTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/SunTest.java @@ -5,15 +5,13 @@ import org.junit.contrib.java.lang.system.ExpectedSystemExit; import org.tatools.sunshine.core.Status.Fake; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ * @since 0.2 */ public class SunTest { - @Rule - public final ExpectedSystemExit exit = ExpectedSystemExit.none(); + @Rule public final ExpectedSystemExit exit = ExpectedSystemExit.none(); @Test public void shine() { diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/SunshineSuitePrintableTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/SunshineSuitePrintableTest.java index cf2163b..5606f09 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/SunshineSuitePrintableTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/SunshineSuitePrintableTest.java @@ -1,6 +1,5 @@ package org.tatools.sunshine.core; - import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; @@ -17,7 +16,6 @@ public void tests() throws SuiteException { final SunshineTest.Fake test = new SunshineTest.Fake(); MatcherAssert.assertThat( new SunshineSuitePrintable(new SunshineSuite.Fake(test)).tests(), - Matchers.contains(test) - ); + Matchers.contains(test)); } } diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/TestFromClassTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/TestFromClassTest.java index c3bd36b..8408a9f 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/TestFromClassTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/TestFromClassTest.java @@ -14,24 +14,21 @@ public class TestFromClassTest { public void testObject() throws TestException { MatcherAssert.assertThat( new TestFromClass(TestFromClass.class).object(), - Matchers.equalTo(TestFromClass.class) - ); + Matchers.equalTo(TestFromClass.class)); } @Test public void testToString() { MatcherAssert.assertThat( new TestFromClass(TestFromClass.class).toString(), - Matchers.equalTo("org.tatools.sunshine.core.TestFromClass") - ); + Matchers.equalTo("org.tatools.sunshine.core.TestFromClass")); } @Test public void testFilter() { MatcherAssert.assertThat( - new TestFromClass(TestFromClass.class).match("org.tatools.sunshine.core.TestFromClass"::equals), - Matchers.is(true) - ); + new TestFromClass(TestFromClass.class) + .match("org.tatools.sunshine.core.TestFromClass"::equals), + Matchers.is(true)); } - -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/TestFromFileTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/TestFromFileTest.java index 02386a9..3677f68 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/TestFromFileTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/TestFromFileTest.java @@ -14,33 +14,28 @@ public class TestFromFileTest { public void object() throws TestException { MatcherAssert.assertThat( new TestFromFile("org/tatools/sunshine/core/TestFromFile.class").object(), - Matchers.equalTo(TestFromFile.class) - ); + Matchers.equalTo(TestFromFile.class)); } @Test public void testToStringWithClassExtension() { MatcherAssert.assertThat( new TestFromFile("org/tatools/sunshine/core/TestFromFile.class").toString(), - Matchers.equalTo("org.tatools.sunshine.core.TestFromFile") - ); + Matchers.equalTo("org.tatools.sunshine.core.TestFromFile")); } @Test public void testToStringWithoutClassExtension() { MatcherAssert.assertThat( new TestFromFile("org/tatools/sunshine/core/TestFromFile").toString(), - Matchers.equalTo("org.tatools.sunshine.core.TestFromFile") - ); + Matchers.equalTo("org.tatools.sunshine.core.TestFromFile")); } - @Test public void testFilter() { MatcherAssert.assertThat( new TestFromFile("org/tatools/sunshine/core/TestFromFile") .match("org.tatools.sunshine.core.TestFromFile"::equals), - Matchers.is(true) - ); + Matchers.is(true)); } -} \ No newline at end of file +} diff --git a/sunshine-core/src/test/java/org/tatools/sunshine/core/VerboseRegexTest.java b/sunshine-core/src/test/java/org/tatools/sunshine/core/VerboseRegexTest.java index 860f93b..de03b64 100644 --- a/sunshine-core/src/test/java/org/tatools/sunshine/core/VerboseRegexTest.java +++ b/sunshine-core/src/test/java/org/tatools/sunshine/core/VerboseRegexTest.java @@ -1,12 +1,11 @@ package org.tatools.sunshine.core; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -17,12 +16,12 @@ public class VerboseRegexTest { @Test public void testIfMessageIsDisplayedOnce() { final ByteArrayOutputStream result = new ByteArrayOutputStream(); - final VerboseRegex regex = new VerboseRegex(new RegexCondition("ddd"), new PrintStream(result)); + final VerboseRegex regex = + new VerboseRegex(new RegexCondition("ddd"), new PrintStream(result)); regex.applicable("a"); regex.applicable("b"); MatcherAssert.assertThat( new String(result.toByteArray()), - Matchers.is("The following pattern will be used for classes filtering: ddd\n") - ); + Matchers.is("The following pattern will be used for classes filtering: ddd\n")); } } diff --git a/sunshine-junit4-integration-tests/src/main/java/org/tatools/junit4tests/PassedTest.java b/sunshine-junit4-integration-tests/src/main/java/org/tatools/junit4tests/PassedTest.java index 4678914..6f92dab 100644 --- a/sunshine-junit4-integration-tests/src/main/java/org/tatools/junit4tests/PassedTest.java +++ b/sunshine-junit4-integration-tests/src/main/java/org/tatools/junit4tests/PassedTest.java @@ -1,6 +1,5 @@ package org.tatools.junit4tests; - import org.junit.Test; /** @@ -10,6 +9,5 @@ */ public class PassedTest { @Test - public void test() { - } + public void test() {} } diff --git a/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Junit4Kernel.java b/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Junit4Kernel.java index 342eb93..04eb2e2 100644 --- a/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Junit4Kernel.java +++ b/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Junit4Kernel.java @@ -1,12 +1,11 @@ package org.tatools.sunshine.junit4; +import java.util.Arrays; import org.junit.runner.Computer; import org.junit.runner.JUnitCore; import org.junit.runner.notification.RunListener; import org.tatools.sunshine.core.*; -import java.util.Arrays; - /** * The class provides a {@link Kernel} implementation of JUnit runner. * @@ -20,8 +19,8 @@ public class Junit4Kernel implements Kernel { private final Suite[]> suiteForRun; /** - * Initializes a newly created {@link Junit4Kernel} object so that it represents - * an JUnit 4 runner. + * Initializes a newly created {@link Junit4Kernel} object so that it represents an JUnit 4 + * runner. * * @param suite the tests suite */ diff --git a/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/JunitStatus.java b/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/JunitStatus.java index cf69a5c..f364d89 100644 --- a/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/JunitStatus.java +++ b/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/JunitStatus.java @@ -15,8 +15,8 @@ public class JunitStatus implements Status { private final Result status; /** - * Initializes a newly created {@link JunitStatus} object so that it represents - * a status of JUnit 4 execution. + * Initializes a newly created {@link JunitStatus} object so that it represents a status of + * JUnit 4 execution. * * @param result the JUnit 4 result */ diff --git a/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/JunitSuite.java b/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/JunitSuite.java index 754e645..2c416b8 100644 --- a/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/JunitSuite.java +++ b/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/JunitSuite.java @@ -1,9 +1,8 @@ package org.tatools.sunshine.junit4; -import org.tatools.sunshine.core.*; - import java.util.ArrayList; import java.util.List; +import org.tatools.sunshine.core.*; /** * The {@link JunitSuite} class represents a JUnit 4 suite prepared from the Java classes. @@ -17,7 +16,8 @@ public class JunitSuite implements Suite[]> { private final SunshineSuite suite; /** - * Construct the new instance with the specified tests filter. All tests will be loaded from the classpath. + * Construct the new instance with the specified tests filter. All tests will be loaded from the + * classpath. * * @param filter the filter to be used to select desired tests * @see #JunitSuite(FileSystem, Condition) @@ -28,15 +28,17 @@ public JunitSuite(Condition filter) { } /** - * Construct the new instance with the specified file system and tests filter. All filtered tests - * will be printed to {@link System#out}. + * Construct the new instance with the specified file system and tests filter. All filtered + * tests will be printed to {@link System#out}. * * @param fileSystem the place with the tests - * @param filter the filter to be used to select desired tests + * @param filter the filter to be used to select desired tests * @since 0.1 */ public JunitSuite(FileSystem fileSystem, Condition filter) { - this(new SunshineSuitePrintable(new SunshineSuiteFilterable(new SuiteFromFileSystem(fileSystem), filter))); + this( + new SunshineSuitePrintable( + new SunshineSuiteFilterable(new SuiteFromFileSystem(fileSystem), filter))); } /** @@ -59,6 +61,6 @@ public final Class[] tests() throws SuiteException { throw new SuiteException(e); } } - return tests.toArray(new Class[]{}); + return tests.toArray(new Class[] {}); } } diff --git a/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java b/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java index 72b421d..9c0779a 100644 --- a/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java +++ b/sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java @@ -1,6 +1,5 @@ package org.tatools.sunshine.junit4; - import org.tatools.sunshine.core.RegexCondition; import org.tatools.sunshine.core.Sun; import org.tatools.sunshine.core.VerboseRegex; diff --git a/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/Junit4KernelTest.java b/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/Junit4KernelTest.java index 0176758..ea58449 100644 --- a/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/Junit4KernelTest.java +++ b/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/Junit4KernelTest.java @@ -18,23 +18,24 @@ public class Junit4KernelTest { @Test public void run() throws KernelException { MatcherAssert.assertThat( - new Junit4Kernel(() -> new Class[]{}).status().code(), - Matchers.equalTo((short) 0) - ); + new Junit4Kernel(() -> new Class[] {}).status().code(), + Matchers.equalTo((short) 0)); } @Test(expected = KernelException.class) public void runWithFail() throws KernelException { - new Junit4Kernel(() -> { - throw new SuiteException("Fail"); - }).status(); + new Junit4Kernel( + () -> { + throw new SuiteException("Fail"); + }) + .status(); } @Test public void with() throws KernelException { final Listener l1 = new Listener(); final Listener l2 = new Listener(); - new Junit4Kernel(() -> new Class[]{}).with(l1).with(l2).status(); + new Junit4Kernel(() -> new Class[] {}).with(l1).with(l2).status(); MatcherAssert.assertThat(l1, Matchers.not(Matchers.equalTo(l2))); } diff --git a/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitStatusTest.java b/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitStatusTest.java index 82bbe59..21e6cf4 100644 --- a/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitStatusTest.java +++ b/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitStatusTest.java @@ -5,7 +5,6 @@ import org.junit.Test; import org.junit.runner.Result; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -15,41 +14,31 @@ public class JunitStatusTest { @Test public void codeIfPassed() { MatcherAssert.assertThat( - new JunitStatus(new FakeResult(true, 0, 0, 0)).code(), - Matchers.is((short) 0) - ); + new JunitStatus(new FakeResult(true, 0, 0, 0)).code(), Matchers.is((short) 0)); } @Test public void codeIfFailed() { MatcherAssert.assertThat( - new JunitStatus(new FakeResult(false, 0, 0, 0)).code(), - Matchers.is((short) 1) - ); + new JunitStatus(new FakeResult(false, 0, 0, 0)).code(), Matchers.is((short) 1)); } @Test public void runCount() { MatcherAssert.assertThat( - new JunitStatus(new FakeResult(false, 3, 0, 0)).runCount(), - Matchers.is(3) - ); + new JunitStatus(new FakeResult(false, 3, 0, 0)).runCount(), Matchers.is(3)); } @Test public void failureCount() { MatcherAssert.assertThat( - new JunitStatus(new FakeResult(false, 0, 2, 0)).failureCount(), - Matchers.is(2) - ); + new JunitStatus(new FakeResult(false, 0, 2, 0)).failureCount(), Matchers.is(2)); } @Test public void ignoreCount() { MatcherAssert.assertThat( - new JunitStatus(new FakeResult(false, 0, 0, 5)).ignoreCount(), - Matchers.is(5) - ); + new JunitStatus(new FakeResult(false, 0, 0, 5)).ignoreCount(), Matchers.is(5)); } private final class FakeResult extends Result { diff --git a/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java b/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java index 0c2a4c6..0820ce0 100644 --- a/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java +++ b/sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java @@ -1,5 +1,6 @@ package org.tatools.sunshine.junit4; +import java.util.Collections; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; @@ -7,8 +8,6 @@ import org.tatools.sunshine.core.FileSystem; import org.tatools.sunshine.core.SuiteException; -import java.util.Collections; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -18,24 +17,19 @@ public class JunitSuiteTest { @Test public void testDefaultSuite() throws SuiteException { MatcherAssert.assertThat( - new JunitSuite(() -> Collections.emptyList()).tests(), - Matchers.arrayWithSize(0) - ); + new JunitSuite(() -> Collections.emptyList()).tests(), Matchers.arrayWithSize(0)); } @Test public void testDefaultFileSystemAndTestsFilter() throws SuiteException { MatcherAssert.assertThat( new JunitSuite(new FileSystem.Fake(), new Condition.Fake(false)).tests(), - Matchers.arrayWithSize(0) - ); + Matchers.arrayWithSize(0)); } @Test public void testDefaultTestsFilter() throws SuiteException { MatcherAssert.assertThat( - new JunitSuite(new Condition.Fake(false)).tests(), - Matchers.arrayWithSize(0) - ); + new JunitSuite(new Condition.Fake(false)).tests(), Matchers.arrayWithSize(0)); } -} \ No newline at end of file +} diff --git a/sunshine-junit5-integration-tests/src/main/java/org/tatools/junit5tests/PassedTest.java b/sunshine-junit5-integration-tests/src/main/java/org/tatools/junit5tests/PassedTest.java index 41d50a4..32c9a51 100644 --- a/sunshine-junit5-integration-tests/src/main/java/org/tatools/junit5tests/PassedTest.java +++ b/sunshine-junit5-integration-tests/src/main/java/org/tatools/junit5tests/PassedTest.java @@ -1,6 +1,5 @@ package org.tatools.junit5tests; - import org.junit.jupiter.api.Test; /** @@ -9,6 +8,5 @@ */ public class PassedTest { @Test - public void test() { - } + public void test() {} } diff --git a/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Junit5Kernel.java b/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Junit5Kernel.java index c955e7d..cacdbc4 100644 --- a/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Junit5Kernel.java +++ b/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Junit5Kernel.java @@ -22,8 +22,8 @@ public class Junit5Kernel implements Kernel { private final SummaryGeneratingListener reporter; /** - * Initializes a newly created {@link Junit5Kernel} object so that it represents - * an JUnit 4 runner. + * Initializes a newly created {@link Junit5Kernel} object so that it represents an JUnit 4 + * runner. * * @param sunshineSuite the suite with desired tests */ @@ -32,8 +32,8 @@ public Junit5Kernel(SunshineSuite sunshineSuite) { } /** - * Initializes a newly created {@link Junit5Kernel} object so that it represents - * an JUnit 4 runner. + * Initializes a newly created {@link Junit5Kernel} object so that it represents an JUnit 4 + * runner. * * @param launcher the launcher for a given test suite * @param sunshineSuite the suite with desired tests @@ -57,11 +57,13 @@ public final Status status() throws KernelException { launcher.execute( LauncherDiscoveryRequestBuilder.request() .selectors( - tests.tests().stream().map( - sunshineTest -> DiscoverySelectors.selectClass(sunshineTest.toString()) - ).toArray(DiscoverySelector[]::new) - ).build() - ); + tests.tests().stream() + .map( + sunshineTest -> + DiscoverySelectors.selectClass( + sunshineTest.toString())) + .toArray(DiscoverySelector[]::new)) + .build()); return new Junit5Status(this.reporter.getSummary()); } catch (SuiteException e) { throw new KernelException("Some problem occurs in the Junit5Kernel", e); @@ -69,14 +71,15 @@ public final Status status() throws KernelException { } /** - * Returns a new instance of the JUnit 5 kernel with provided listeners based - * on the current instance configuration. + * Returns a new instance of the JUnit 5 kernel with provided listeners based on the current + * instance configuration. * * @param testExecutionListeners at least one desired listener * @return the new instance of the JUnit 5 kernel */ @Override - public final Kernel with(TestExecutionListener... testExecutionListeners) { + public final Kernel with( + TestExecutionListener... testExecutionListeners) { final Launcher fork = LauncherFactory.create(); fork.registerTestExecutionListeners(testExecutionListeners); return new Junit5Kernel(fork, this.tests); diff --git a/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Junit5Status.java b/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Junit5Status.java index de8e7c3..80a6656 100644 --- a/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Junit5Status.java +++ b/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Junit5Status.java @@ -16,8 +16,7 @@ public class Junit5Status implements Status { private final short failed = 1; /** - * Initializes a newly created instance to represent a status of - * JUnit 5 execution. + * Initializes a newly created instance to represent a status of JUnit 5 execution. * * @param testExecutionSummary the report provided by {@link SummaryGeneratingListener} */ diff --git a/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Sunshine.java b/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Sunshine.java index 975445e..621acf3 100644 --- a/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Sunshine.java +++ b/sunshine-junit5/src/main/java/org/tatools/sunshine/junit5/Sunshine.java @@ -1,6 +1,5 @@ package org.tatools.sunshine.junit5; - import org.tatools.sunshine.core.*; /** @@ -13,16 +12,12 @@ public final class Sunshine { public static void main(String[] args) { new Sun( - new Junit5Kernel( - new SunshineSuitePrintable( - new SunshineSuiteFilterable( - new SuiteFromFileSystem( - new FileSystemOfClasspathClasses() - ), - new VerboseRegex(new RegexCondition()) - ) - ) - ) - ).shine(); + new Junit5Kernel( + new SunshineSuitePrintable( + new SunshineSuiteFilterable( + new SuiteFromFileSystem( + new FileSystemOfClasspathClasses()), + new VerboseRegex(new RegexCondition()))))) + .shine(); } } diff --git a/sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5KernelTest.java b/sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5KernelTest.java index 2eeec2a..4f516ec 100644 --- a/sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5KernelTest.java +++ b/sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5KernelTest.java @@ -1,5 +1,6 @@ package org.tatools.sunshine.junit5; +import java.util.ArrayList; import lombok.EqualsAndHashCode; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -9,9 +10,6 @@ import org.junit.platform.launcher.TestIdentifier; import org.tatools.sunshine.core.KernelException; -import java.util.ArrayList; - - /** * @author Dmytro Serdiuk * @version $Id$ @@ -21,12 +19,9 @@ public class Junit5KernelTest { @Test public void run() throws KernelException { MatcherAssert.assertThat( - new Junit5Kernel(ArrayList::new).status().code(), - Matchers.equalTo((short) 0) - ); + new Junit5Kernel(ArrayList::new).status().code(), Matchers.equalTo((short) 0)); } - @Test public void with() throws KernelException { final Listener l1 = new Listener(); @@ -40,7 +35,8 @@ private final class Listener implements TestExecutionListener { private int call = 0; @Override - public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { + public void executionFinished( + TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { this.call = 1; } } diff --git a/sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5StatusTest.java b/sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5StatusTest.java index ee86f9a..73c96c8 100644 --- a/sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5StatusTest.java +++ b/sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5StatusTest.java @@ -1,13 +1,12 @@ package org.tatools.sunshine.junit5; +import java.io.PrintWriter; +import java.util.List; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; import org.junit.platform.launcher.listeners.TestExecutionSummary; -import java.io.PrintWriter; -import java.util.List; - /** * @author Dmytro Serdiuk * @version $Id$ @@ -17,41 +16,31 @@ class Junit5StatusTest { @Test void codePassed() { MatcherAssert.assertThat( - new Junit5Status(new Summary(1, 0, 0, 0)).code(), - Matchers.is((short)0) - ); + new Junit5Status(new Summary(1, 0, 0, 0)).code(), Matchers.is((short) 0)); } @Test void codeFailed() { MatcherAssert.assertThat( - new Junit5Status(new Summary(1, 0, 0, 1)).code(), - Matchers.is((short)1) - ); + new Junit5Status(new Summary(1, 0, 0, 1)).code(), Matchers.is((short) 1)); } @Test void runCount() { MatcherAssert.assertThat( - new Junit5Status(new Summary(5, 4, 3, 1)).runCount(), - Matchers.is(5) - ); + new Junit5Status(new Summary(5, 4, 3, 1)).runCount(), Matchers.is(5)); } @Test void failureCount() { MatcherAssert.assertThat( - new Junit5Status(new Summary(5, 4, 3, 1)).failureCount(), - Matchers.is(4) - ); + new Junit5Status(new Summary(5, 4, 3, 1)).failureCount(), Matchers.is(4)); } @Test void ignoreCount() { MatcherAssert.assertThat( - new Junit5Status(new Summary(5, 4, 3, 1)).ignoreCount(), - Matchers.is(3) - ); + new Junit5Status(new Summary(5, 4, 3, 1)).ignoreCount(), Matchers.is(3)); } private final class Summary implements TestExecutionSummary { @@ -60,7 +49,8 @@ private final class Summary implements TestExecutionSummary { private final long skippedCount; private final long totalFailedCount; - public Summary(long totalTests, long failedCount, long skippedCount, long totalFailedCount) { + public Summary( + long totalTests, long failedCount, long skippedCount, long totalFailedCount) { this.totalTests = totalTests; this.failedCount = failedCount; this.skippedCount = skippedCount; @@ -143,14 +133,10 @@ public long getTestsFailedCount() { } @Override - public void printTo(PrintWriter writer) { - - } + public void printTo(PrintWriter writer) {} @Override - public void printFailuresTo(PrintWriter writer) { - - } + public void printFailuresTo(PrintWriter writer) {} @Override public List getFailures() { diff --git a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/LoadableTestNGSuite.java b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/LoadableTestNGSuite.java index c368ffa..47df79b 100644 --- a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/LoadableTestNGSuite.java +++ b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/LoadableTestNGSuite.java @@ -1,14 +1,13 @@ package org.tatools.sunshine.testng; +import java.io.IOException; import org.tatools.sunshine.core.*; import org.testng.xml.XmlSuite; import org.testng.xml.XmlTest; -import java.io.IOException; - /** - * The {@link LoadableTestNGSuite} class represents a TestNG suite prepared from the Java classes. The suite has to - * be saved as a TestNG XML file. + * The {@link LoadableTestNGSuite} class represents a TestNG suite prepared from the Java classes. + * The suite has to be saved as a TestNG XML file. * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -23,8 +22,8 @@ public class LoadableTestNGSuite implements TestNGSuite { private final File suiteXml; /** - * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via wrapping of - * {@link #LoadableTestNGSuite(String, Condition)}. + * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via + * wrapping of {@link #LoadableTestNGSuite(String, Condition)}. * * @param filter the filter to be used to select desired tests * @see #LoadableTestNGSuite(String, Condition) @@ -37,18 +36,18 @@ public LoadableTestNGSuite(Condition filter) { * Construct the new instance. All tests will be loaded from the classpath. * * @param suiteName the name of the suite - * @param filter the filter to be used to select desired tests + * @param filter the filter to be used to select desired tests */ public LoadableTestNGSuite(String suiteName, Condition filter) { this(suiteName, new FileSystemOfClasspathClasses(), filter); } /** - * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via wrapping of - * {@link #LoadableTestNGSuite(String, FileSystem, Condition)}. + * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via + * wrapping of {@link #LoadableTestNGSuite(String, FileSystem, Condition)}. * * @param fileSystem the place with the tests - * @param filter the filter to be used to select desired tests + * @param filter the filter to be used to select desired tests * @see #LoadableTestNGSuite(String, FileSystem, Condition) */ public LoadableTestNGSuite(FileSystem fileSystem, Condition filter) { @@ -57,19 +56,23 @@ public LoadableTestNGSuite(FileSystem fileSystem, Condition filter) { /** * Construct the new instance. All filtered tests will be printed to {@link System#out}. - *

The TestNG XML file will be saved to the default temporary folder.

* - * @param suiteName the name of the suite + *

The TestNG XML file will be saved to the default temporary folder. + * + * @param suiteName the name of the suite * @param fileSystem the place with the tests - * @param filter the filter to be used to select desired tests + * @param filter the filter to be used to select desired tests */ public LoadableTestNGSuite(String suiteName, FileSystem fileSystem, Condition filter) { - this(suiteName, new SunshineSuitePrintable(new SunshineSuiteFilterable(new SuiteFromFileSystem(fileSystem), filter))); + this( + suiteName, + new SunshineSuitePrintable( + new SunshineSuiteFilterable(new SuiteFromFileSystem(fileSystem), filter))); } /** - * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via wrapping of - * {@link #LoadableTestNGSuite(String, SunshineSuite)}. + * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via + * wrapping of {@link #LoadableTestNGSuite(String, SunshineSuite)}. * * @param suite the tests to be used * @see #LoadableTestNGSuite(String, SunshineSuite) @@ -80,29 +83,29 @@ public LoadableTestNGSuite(SunshineSuite suite) { /** * Construct the new instance. - *

The TestNG XML file will be saved to the temporary directory named "./sunshine-generated-suites".

+ * + *

The TestNG XML file will be saved to the temporary directory named + * "./sunshine-generated-suites". * * @param suiteName the name of the suite - * @param suite the tests to be used + * @param suite the tests to be used */ public LoadableTestNGSuite(String suiteName, SunshineSuite suite) { - this(suiteName, + this( + suiteName, suite, new DirectoryWithAutomaticCreation( new DirectoryWithAutomaticDeletion( - new DirectorySafe("./sunshine-generated-suites") - ) - ) - ); + new DirectorySafe("./sunshine-generated-suites")))); } /** - * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via wrapping of - * {@link #LoadableTestNGSuite(String, FileSystem, String, Condition)}. + * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via + * wrapping of {@link #LoadableTestNGSuite(String, FileSystem, String, Condition)}. * - * @param fileSystem the place with the tests + * @param fileSystem the place with the tests * @param xmlSuiteDirectory the place to store suite file - * @param filter the filter to be used to select desired tests + * @param filter the filter to be used to select desired tests * @see #LoadableTestNGSuite(String, FileSystem, String, Condition) */ public LoadableTestNGSuite(FileSystem fileSystem, String xmlSuiteDirectory, Condition filter) { @@ -110,56 +113,63 @@ public LoadableTestNGSuite(FileSystem fileSystem, String xmlSuiteDirectory, Cond } /** - * Construct the new instance. If suite's directory ({@code xmlSuiteDirectory}) doesn't exist, it will be created - * automatically. + * Construct the new instance. If suite's directory ({@code xmlSuiteDirectory}) doesn't exist, + * it will be created automatically. * - * @param suiteName the name of the suite - * @param fileSystem the place with the tests + * @param suiteName the name of the suite + * @param fileSystem the place with the tests * @param xmlSuiteDirectory the place to store suite file - * @param filter the filter to be used to select desired tests + * @param filter the filter to be used to select desired tests */ - public LoadableTestNGSuite(String suiteName, FileSystem fileSystem, String xmlSuiteDirectory, Condition filter) { - this(suiteName, + public LoadableTestNGSuite( + String suiteName, FileSystem fileSystem, String xmlSuiteDirectory, Condition filter) { + this( + suiteName, fileSystem, - new DirectoryWithAutomaticCreation(new DirectorySafe(new DirectoryBase(xmlSuiteDirectory))), - filter - ); + new DirectoryWithAutomaticCreation( + new DirectorySafe(new DirectoryBase(xmlSuiteDirectory))), + filter); } - /** - * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via wrapping of - * {@link #LoadableTestNGSuite(String, FileSystem, Directory, Condition)}. + * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via + * wrapping of {@link #LoadableTestNGSuite(String, FileSystem, Directory, Condition)}. * - * @param fileSystem the place with the tests + * @param fileSystem the place with the tests * @param xmlSuiteDirectory the place to store suite file - * @param filter the filter to be used to select desired tests + * @param filter the filter to be used to select desired tests * @see #LoadableTestNGSuite(String, FileSystem, Directory, Condition) */ - public LoadableTestNGSuite(FileSystem fileSystem, Directory xmlSuiteDirectory, Condition filter) { + public LoadableTestNGSuite( + FileSystem fileSystem, Directory xmlSuiteDirectory, Condition filter) { this(SUNSHINE_SUITE, fileSystem, xmlSuiteDirectory, filter); } /** * Construct the new instance. All filtered tests will be printed to {@link System#out}. * - * @param suiteName the name of the suite - * @param fileSystem the place with the tests + * @param suiteName the name of the suite + * @param fileSystem the place with the tests * @param xmlSuiteDirectory the place to store suite file - * @param filter the filter to be used to select desired tests + * @param filter the filter to be used to select desired tests */ - public LoadableTestNGSuite(String suiteName, FileSystem fileSystem, Directory xmlSuiteDirectory, Condition filter) { - this(suiteName, - new SunshineSuitePrintable(new SunshineSuiteFilterable(new SuiteFromFileSystem(fileSystem), filter)), - xmlSuiteDirectory - ); + public LoadableTestNGSuite( + String suiteName, + FileSystem fileSystem, + Directory xmlSuiteDirectory, + Condition filter) { + this( + suiteName, + new SunshineSuitePrintable( + new SunshineSuiteFilterable(new SuiteFromFileSystem(fileSystem), filter)), + xmlSuiteDirectory); } /** - * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via wrapping of - * {@link #LoadableTestNGSuite(String, SunshineSuite, Directory)}. + * Construct the new instance. The {@value #SUNSHINE_SUITE} is used as a name of the suite via + * wrapping of {@link #LoadableTestNGSuite(String, SunshineSuite, Directory)}. * - * @param suite the tests to be used + * @param suite the tests to be used * @param xmlSuiteDirectory the directory to store suite file * @see #LoadableTestNGSuite(String, SunshineSuite, Directory) */ @@ -170,8 +180,8 @@ public LoadableTestNGSuite(SunshineSuite suite, Directory xmlSuiteDirectory) { /** * Construct the new instance. "sunshine-suite.xml" is used as a name for XML suite file. * - * @param suiteName the name of the suite - * @param suite the tests to be used + * @param suiteName the name of the suite + * @param suite the tests to be used * @param xmlSuiteDirectory the directory to store suite file */ public LoadableTestNGSuite(String suiteName, SunshineSuite suite, Directory xmlSuiteDirectory) { @@ -181,8 +191,8 @@ public LoadableTestNGSuite(String suiteName, SunshineSuite suite, Directory xmlS /** * Construct the new instance. * - * @param suiteName the name of the suite - * @param suite the suite + * @param suiteName the name of the suite + * @param suite the suite * @param xmlFileName the name of TestNG XML file */ public LoadableTestNGSuite(String suiteName, SunshineSuite suite, File xmlFileName) { diff --git a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java index 545790f..f42195c 100644 --- a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java +++ b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java @@ -6,9 +6,12 @@ /** * The {@link Sunshine} class is a main class to run TestNG tests. - *

If no arguments will be provided, then Sunshine will try to find TestNG tests in the CLASSPATH.

- *

If an argument will be provided, then Sunshine will run TestNG with given argument. - * The argument is a path to TestNG configuration file (XML or YAML).

+ * + *

If no arguments will be provided, then Sunshine will try to find TestNG tests in the + * CLASSPATH. + * + *

If an argument will be provided, then Sunshine will run TestNG with given argument. The + * argument is a path to TestNG configuration file (XML or YAML). * * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -20,7 +23,11 @@ public static void main(String[] args) { if (args != null && args.length > 0) { new Sun(new TestNGKernel(new PreparedTestNGSuite(args[0]))).shine(); } else { - new Sun(new TestNGKernel(new LoadableTestNGSuite(new VerboseRegex(new RegexCondition())))).shine(); + new Sun( + new TestNGKernel( + new LoadableTestNGSuite( + new VerboseRegex(new RegexCondition())))) + .shine(); } } } diff --git a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/SunshineTestNG.java b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/SunshineTestNG.java index b460d8e..2851c6c 100644 --- a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/SunshineTestNG.java +++ b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/SunshineTestNG.java @@ -1,10 +1,9 @@ package org.tatools.sunshine.testng; +import java.util.List; import org.testng.ISuite; import org.testng.TestNG; -import java.util.List; - /** * The {@link SunshineTestNG} class is the default configuration of TestNG defined for Sunshine. * @@ -17,8 +16,8 @@ final class SunshineTestNG extends TestNG { private final List database; /** - * Constructs the instance of TestNG without default listeners and with 0 verbose mode (no logs). All executed - * suites will be saved to a given list. + * Constructs the instance of TestNG without default listeners and with 0 verbose mode (no + * logs). All executed suites will be saved to a given list. * * @param suitesHolder the list to store suites */ diff --git a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGKernel.java b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGKernel.java index d502e3c..fa1d2ec 100644 --- a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGKernel.java +++ b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGKernel.java @@ -1,14 +1,13 @@ package org.tatools.sunshine.testng; -import org.tatools.sunshine.core.*; -import org.testng.ISuite; -import org.testng.ITestNGListener; -import org.testng.TestNG; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.tatools.sunshine.core.*; +import org.testng.ISuite; +import org.testng.ITestNGListener; +import org.testng.TestNG; /** * The {@link TestNGKernel} class allows to run TestNG for given {@link FileSystem}. @@ -24,8 +23,8 @@ public class TestNGKernel implements Kernel { private final List suites; /** - * Initializes a newly created {@link TestNGKernel} object so that it represents - * an TestNG runner. + * Initializes a newly created {@link TestNGKernel} object so that it represents an TestNG + * runner. * * @param tests an instance of a {@link TestNGSuite} where need to find tests */ @@ -35,12 +34,12 @@ public TestNGKernel(TestNGSuite tests) { this.suite = tests; } - @Override public final Status status() throws KernelException { try { this.suites.clear(); - this.engine.setTestSuites(Collections.singletonList(this.suite.tests().path().toString())); + this.engine.setTestSuites( + Collections.singletonList(this.suite.tests().path().toString())); this.engine.run(); return new TestNGStatus(engine.getStatus(), this.suites); } catch (SuiteException e) { diff --git a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGStatus.java b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGStatus.java index 306f659..1c15a0f 100644 --- a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGStatus.java +++ b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGStatus.java @@ -1,13 +1,12 @@ package org.tatools.sunshine.testng; +import java.util.ArrayList; +import java.util.List; import org.tatools.sunshine.core.Status; import org.testng.ISuite; import org.testng.ISuiteResult; import org.testng.ITestContext; -import java.util.ArrayList; -import java.util.List; - /** * The class provides an implementation of the {@link Status} of TestNG execution. * diff --git a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGTest.java b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGTest.java index dc04850..9d3e448 100644 --- a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGTest.java +++ b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGTest.java @@ -1,11 +1,10 @@ package org.tatools.sunshine.testng; +import java.util.Collections; import org.tatools.sunshine.core.*; import org.testng.xml.XmlClass; import org.testng.xml.XmlTest; -import java.util.Collections; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -34,8 +33,7 @@ public XmlTest object() throws TestException { public boolean match(Condition condition) { throw new UnsupportedOperationException( String.format( - "%s is not able to handle %s condition", this.getClass().getName(), condition.getClass().getName() - ) - ); + "%s is not able to handle %s condition", + this.getClass().getName(), condition.getClass().getName())); } } diff --git a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/LoadableTestNGSuiteTest.java b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/LoadableTestNGSuiteTest.java index 685f998..ef70c92 100644 --- a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/LoadableTestNGSuiteTest.java +++ b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/LoadableTestNGSuiteTest.java @@ -7,7 +7,6 @@ import org.junit.rules.TemporaryFolder; import org.tatools.sunshine.core.*; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ @@ -15,44 +14,36 @@ */ public class LoadableTestNGSuiteTest { - @Rule - public TemporaryFolder testFolder = new TemporaryFolder(); + @Rule public TemporaryFolder testFolder = new TemporaryFolder(); @Test public void testAutomaticSuiteDirectoryCreation() throws SuiteException { MatcherAssert.assertThat( new LoadableTestNGSuite( - new FileSystem.Fake(), - this.testFolder.getRoot().getAbsolutePath() + "/custom", - new Condition.Fake(true) - ).tests(), - new SuiteFileMatcher() - ); + new FileSystem.Fake(), + this.testFolder.getRoot().getAbsolutePath() + "/custom", + new Condition.Fake(true)) + .tests(), + new SuiteFileMatcher()); } @Test public void testDefaultSuiteDirectoryCreation() throws SuiteException { MatcherAssert.assertThat( - new LoadableTestNGSuite(new SunshineSuite.Fake()).tests(), - new SuiteFileMatcher() - ); + new LoadableTestNGSuite(new SunshineSuite.Fake()).tests(), new SuiteFileMatcher()); } - @Test public void testFileSystemFilteringWithDefaultSuiteFolder() throws SuiteException { MatcherAssert.assertThat( new LoadableTestNGSuite(new FileSystem.Fake(), new Condition.Fake(true)).tests(), - new SuiteFileMatcher() - ); + new SuiteFileMatcher()); } @Test public void testDefaultTestsFiltering() throws SuiteException { MatcherAssert.assertThat( - new LoadableTestNGSuite(new Condition.Fake(false)).tests(), - new SuiteFileMatcher() - ); + new LoadableTestNGSuite(new Condition.Fake(false)).tests(), new SuiteFileMatcher()); } private static class SuiteFileMatcher extends CustomMatcher { @@ -67,4 +58,4 @@ public boolean matches(Object item) { return file.exist(); } } -} \ No newline at end of file +} diff --git a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/SunshineTestNGTest.java b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/SunshineTestNGTest.java index 0a2fc43..ae6cc02 100644 --- a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/SunshineTestNGTest.java +++ b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/SunshineTestNGTest.java @@ -1,13 +1,12 @@ package org.tatools.sunshine.testng; +import java.util.ArrayList; +import java.util.Arrays; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.Test; import org.testng.ISuite; -import java.util.ArrayList; -import java.util.Arrays; - /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ diff --git a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java index ca90dca..8d7223c 100644 --- a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java +++ b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java @@ -19,16 +19,19 @@ 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) - ); + 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(); + new TestNGKernel( + () -> { + throw new SuiteException("Fail"); + }) + .status(); } @Test diff --git a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGStatusTest.java b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGStatusTest.java index 3db4f70..1c5f596 100644 --- a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGStatusTest.java +++ b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGStatusTest.java @@ -1,14 +1,13 @@ package org.tatools.sunshine.testng; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.Test; -import org.testng.ISuite; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; +import org.junit.Test; +import org.testng.ISuite; /** * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) @@ -19,33 +18,25 @@ public class TestNGStatusTest { @Test public void code() { MatcherAssert.assertThat( - new TestNGStatus(4, Collections.emptyList()).code(), - Matchers.equalTo((short) 4) - ); + new TestNGStatus(4, Collections.emptyList()).code(), Matchers.equalTo((short) 4)); } @Test public void runCount() { MatcherAssert.assertThat( - new TestNGStatus(0, this.suites()).runCount(), - Matchers.equalTo(0) - ); + new TestNGStatus(0, this.suites()).runCount(), Matchers.equalTo(0)); } @Test public void failureCount() { MatcherAssert.assertThat( - new TestNGStatus(0, this.suites()).failureCount(), - Matchers.equalTo(0) - ); + new TestNGStatus(0, this.suites()).failureCount(), Matchers.equalTo(0)); } @Test public void ignoreCount() { MatcherAssert.assertThat( - new TestNGStatus(0, this.suites()).ignoreCount(), - Matchers.equalTo(0) - ); + new TestNGStatus(0, this.suites()).ignoreCount(), Matchers.equalTo(0)); } private List suites() { @@ -55,5 +46,4 @@ private List suites() { sunshineTestNG.run(); return suitesHolder; } - } diff --git a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGTestTest.java b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGTestTest.java index 49a71c0..d3c10d2 100644 --- a/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGTestTest.java +++ b/sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGTestTest.java @@ -19,4 +19,4 @@ public void asClassWithGhostClass() throws TestException { public void withRealClass() throws TestException { new TestNGTest("org/tatools/sunshine/core/Test.class").object(); } -} \ No newline at end of file +} diff --git a/workflows b/workflows new file mode 100755 index 0000000..73becaf --- /dev/null +++ b/workflows @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -e + +formatting() { + ./gradlew spotlessApply +} + +testing() { + ./gradlew clean ready +} + +documentation-preview() { + cd docs + rm -rf _build + make html + open _build/html/index.html +} + +main() { + if [[ -n ${1} ]]; then + eval "${1}" + else + cat < + +Workflows: +- formatting runs the Spotless to format the code. +- testing runs unit, integration, and formatting check. +- documentation-preview generates HTML pages and opens in a browser. + +MESSAGE + exit 1 + fi +} + +main ${@}