From 2232ccb89a1e1c84c11a87ce47f8cf536e882af4 Mon Sep 17 00:00:00 2001 From: Dmytro Serdiuk Date: Wed, 30 Oct 2019 22:06:54 +0200 Subject: [PATCH] Simplify the depreciation process All public classes aren't final anymore. And all public methods of public classes are final now. This means that it's possible to extend classes, but it is not possible to change (override) the implemented behavior. --- .../org/tatools/sunshine/core/CompositeStatus.java | 10 +++++----- .../java/org/tatools/sunshine/core/DirectoryBase.java | 10 +++++----- .../java/org/tatools/sunshine/core/DirectorySafe.java | 10 +++++----- .../sunshine/core/DirectoryWithAutomaticCreation.java | 10 +++++----- .../sunshine/core/DirectoryWithAutomaticDeletion.java | 10 +++++----- .../main/java/org/tatools/sunshine/core/FileBase.java | 8 ++++---- .../sunshine/core/FileSystemOfClasspathClasses.java | 4 ++-- .../org/tatools/sunshine/core/FileSystemPathBase.java | 6 +++--- .../tatools/sunshine/core/FileSystemPathRelative.java | 6 +++--- .../org/tatools/sunshine/core/RegexCondition.java | 4 ++-- .../org/tatools/sunshine/core/SuiteFromClasses.java | 4 ++-- .../tatools/sunshine/core/SuiteFromFileSystem.java | 4 ++-- .../src/main/java/org/tatools/sunshine/core/Sun.java | 4 ++-- .../sunshine/core/SunshineSuiteFilterable.java | 4 ++-- .../tatools/sunshine/core/SunshineSuitePrintable.java | 4 ++-- .../java/org/tatools/sunshine/core/TestFromClass.java | 8 ++++---- .../java/org/tatools/sunshine/core/TestFromFile.java | 8 ++++---- .../java/org/tatools/sunshine/core/VerboseRegex.java | 4 ++-- .../org/tatools/sunshine/junit4/Junit4Kernel.java | 6 +++--- .../java/org/tatools/sunshine/junit4/JunitStatus.java | 10 +++++----- .../java/org/tatools/sunshine/junit4/JunitSuite.java | 4 ++-- .../tatools/sunshine/testng/LoadableTestNGSuite.java | 4 ++-- .../tatools/sunshine/testng/PreparedTestNGSuite.java | 4 ++-- .../org/tatools/sunshine/testng/TestNGKernel.java | 6 +++--- .../org/tatools/sunshine/testng/TestNGStatus.java | 11 +++++------ 25 files changed, 81 insertions(+), 82 deletions(-) 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 04ad1dd..daaba17 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 @@ -8,7 +8,7 @@ * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ */ -public final class CompositeStatus implements Status { +public class CompositeStatus implements Status { private final List sources; @@ -30,7 +30,7 @@ public CompositeStatus(List statuses) { * @return a calculated exit code */ @Override - public short code() { + public final short code() { return this.sources.stream() .map(Status::code) .filter(code -> code != 0) @@ -44,7 +44,7 @@ public short code() { * @return a count of total tests */ @Override - public int runCount() { + public final int runCount() { return this.sources.stream().mapToInt(Status::runCount).sum(); } @@ -54,7 +54,7 @@ public int runCount() { * @return a count of failed tests */ @Override - public int failureCount() { + public final int failureCount() { return this.sources.stream().mapToInt(Status::failureCount).sum(); } @@ -64,7 +64,7 @@ public int failureCount() { * @return a count of ignored tests */ @Override - public int ignoreCount() { + public final int ignoreCount() { return this.sources.stream().mapToInt(Status::ignoreCount).sum(); } } 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 f063422..0f833cf 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 @@ -14,7 +14,7 @@ * @since 0.1 */ @EqualsAndHashCode -public final class DirectoryBase implements Directory { +public class DirectoryBase implements Directory { private final FileSystemPath fileSystemPath; @@ -31,12 +31,12 @@ public DirectoryBase(FileSystemPath fileSystemPath) { } @Override - public void create() throws IOException { + public final void create() throws IOException { Files.createDirectory(fileSystemPath.path()); } @Override - public void remove() throws IOException { + public final void remove() throws IOException { Files.walk(fileSystemPath.path(), FileVisitOption.FOLLOW_LINKS) .sorted(Comparator.reverseOrder()) .map(Path::toFile) @@ -44,12 +44,12 @@ public void remove() throws IOException { } @Override - public boolean exist() { + public final boolean exist() { return fileSystemPath.exist(); } @Override - public Path path() { + public final Path path() { return fileSystemPath.path(); } } 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 5275896..f7f52f5 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 @@ -14,7 +14,7 @@ * @since 0.1 */ @EqualsAndHashCode -public final class DirectorySafe implements Directory { +public class DirectorySafe implements Directory { private final Directory directory; @@ -35,26 +35,26 @@ public DirectorySafe(Directory directory) { } @Override - public void create() throws IOException { + public final void create() throws IOException { if (!directory.exist()) { directory.create(); } } @Override - public void remove() throws IOException { + public final void remove() throws IOException { if (directory.exist()) { directory.remove(); } } @Override - public boolean exist() { + public final boolean exist() { return directory.exist(); } @Override - public Path path() { + public final Path path() { return directory.path(); } } diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryWithAutomaticCreation.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryWithAutomaticCreation.java index 80bdcf7..4c57730 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryWithAutomaticCreation.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/DirectoryWithAutomaticCreation.java @@ -8,7 +8,7 @@ * @version $Id$ * @since 0.1 */ -public final class DirectoryWithAutomaticCreation implements Directory { +public class DirectoryWithAutomaticCreation implements Directory { private final Directory directory; @@ -17,17 +17,17 @@ public DirectoryWithAutomaticCreation(Directory directory) { } @Override - public void create() throws IOException { + public final void create() throws IOException { this.directory.create(); } @Override - public void remove() throws IOException { + public final void remove() throws IOException { this.directory.remove(); } @Override - public Path path() { + public final Path path() { try { this.create(); return this.directory.path(); @@ -37,7 +37,7 @@ public Path path() { } @Override - public boolean exist() { + public final boolean exist() { try { this.create(); return true; 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 1cc7b97..fb85fae 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 @@ -9,7 +9,7 @@ * @version $Id$ * @since 0.1 */ -public final class DirectoryWithAutomaticDeletion implements Directory { +public class DirectoryWithAutomaticDeletion implements Directory { private final Directory directory; @@ -18,7 +18,7 @@ public DirectoryWithAutomaticDeletion(Directory directory) { } @Override - public void create() throws IOException { + public final void create() throws IOException { Runtime.getRuntime().addShutdownHook(new Thread("ds") { @Override public void run() { @@ -33,17 +33,17 @@ public void run() { } @Override - public void remove() throws IOException { + public final void remove() throws IOException { directory.remove(); } @Override - public Path path() { + public final Path path() { return directory.path(); } @Override - public boolean exist() { + public final boolean exist() { return directory.exist(); } } 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 b810fb9..c14096a 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 @@ -12,7 +12,7 @@ * @since 0.1 */ @EqualsAndHashCode -public final class FileBase implements File { +public class FileBase implements File { private final FileSystemPath fileSystemPath; @@ -33,17 +33,17 @@ public FileBase(FileSystemPath fileSystemPath) { } @Override - public Path path() { + public final Path path() { return fileSystemPath.path(); } @Override - public boolean exist() { + public final boolean exist() { return fileSystemPath.exist(); } @Override - public void write(String data) throws IOException { + public final void write(String data) throws IOException { Files.write(this.path(), data.getBytes()); } } 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 ef35397..087a807 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 @@ -16,7 +16,7 @@ * @since 0.1 */ @EqualsAndHashCode -public final class FileSystemOfClasspathClasses implements FileSystem { +public class FileSystemOfClasspathClasses implements FileSystem { private final FileSystem fileSystem; @@ -37,7 +37,7 @@ private FileSystemOfClasspathClasses(FileSystem fileSystem) { @Override - public List files() throws FileSystemException { + public final List files() throws FileSystemException { return fileSystem.files(); } } 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 f78530a..bd9b955 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 @@ -14,7 +14,7 @@ */ @EqualsAndHashCode @ToString -public final class FileSystemPathBase implements FileSystemPath { +public class FileSystemPathBase implements FileSystemPath { private final Path directory; private final String file; @@ -41,12 +41,12 @@ public FileSystemPathBase(Path directory, String file) { } @Override - public Path path() { + public final Path path() { return directory.resolve(file); } @Override - public boolean exist() { + public final boolean exist() { return Files.exists(path()); } } 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 b0bb52d..904f6ba 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 @@ -12,7 +12,7 @@ */ @EqualsAndHashCode @ToString(of = {"artifactPath"}) -public final class FileSystemPathRelative implements FileSystemPath { +public class FileSystemPathRelative implements FileSystemPath { private final FileSystemPath fromPath; private final FileSystemPath artifactPath; @@ -30,13 +30,13 @@ public FileSystemPathRelative(FileSystemPath fromPath, FileSystemPath artifactPa } @Override - public Path path() { + public final Path path() { if (fromPath.equals(artifactPath)) return artifactPath.path(); return fromPath.path().relativize(artifactPath.path()); } @Override - public boolean exist() { + public final boolean exist() { 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/RegexCondition.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java index 81c14a0..b34a92d 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 @@ -12,7 +12,7 @@ * @since 0.1 */ @EqualsAndHashCode -public final class RegexCondition implements Condition { +public class RegexCondition implements Condition { final Pattern regex; @@ -43,7 +43,7 @@ public RegexCondition(Pattern regex) { } @Override - public boolean applicable(String identity) { + public final boolean applicable(String identity) { return regex.matcher(identity).matches(); } } diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteFromClasses.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteFromClasses.java index a8dd60c..a853b6d 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteFromClasses.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteFromClasses.java @@ -10,7 +10,7 @@ * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ */ -public final class SuiteFromClasses implements SunshineSuite { +public class SuiteFromClasses implements SunshineSuite { private final Class[] classes; /** @@ -23,7 +23,7 @@ public SuiteFromClasses(Class... clazz) { } @Override - public List tests() throws SuiteException { + public final List tests() throws SuiteException { return Arrays.stream(this.classes).map(TestFromClass::new).collect(Collectors.toList()); } } 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 ab57b73..f4b702c 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 @@ -10,7 +10,7 @@ * @author Dmytro Serdiuk (dmytro.serdiuk@gmail.com) * @version $Id$ */ -public final class SuiteFromFileSystem implements SunshineSuite { +public class SuiteFromFileSystem implements SunshineSuite { private final FileSystem fileSystem; /** @@ -24,7 +24,7 @@ public SuiteFromFileSystem(FileSystem fileSystem) { } @Override - public List tests() throws SuiteException { + public final List tests() throws SuiteException { try { return fileSystem.files().stream() .map(f -> new TestFromFile(f.path().toString())) 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 49270b3..40a97e0 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 @@ -8,7 +8,7 @@ * @version $Id$ * @since 0.2 */ -public final class Sun implements Star { +public class Sun implements Star { private static final int SUNSHINE_ERROR = 12; private final Kernel core; @@ -28,7 +28,7 @@ public Sun(Kernel kernel) { * appropriate {@link Kernel}. */ @Override - public void shine() { + public final void shine() { try { final Status status = this.core.status(); System.out.println( 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 8d965f0..71e8896 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 @@ -8,7 +8,7 @@ * @version $Id$ * @since 0.1 */ -public final class SunshineSuiteFilterable implements SunshineSuite { +public class SunshineSuiteFilterable implements SunshineSuite { private final SunshineSuite suite; private final Condition filter; @@ -19,7 +19,7 @@ public SunshineSuiteFilterable(SunshineSuite suite, Condition filter) { } @Override - public List tests() throws SuiteException { + public final List tests() throws SuiteException { 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 d89797b..33258e6 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 @@ -7,7 +7,7 @@ * @version $Id$ * @since 0.1 */ -public final class SunshineSuitePrintable implements SunshineSuite { +public class SunshineSuitePrintable implements SunshineSuite { private final SunshineSuite sunshineSuite; @@ -16,7 +16,7 @@ public SunshineSuitePrintable(SunshineSuite sunshineSuite) { } @Override - public List tests() throws SuiteException { + public final List tests() throws SuiteException { final List tests = this.sunshineSuite.tests(); final StringBuilder message = new StringBuilder(); message.append("Sunshine found ") diff --git a/sunshine-core/src/main/java/org/tatools/sunshine/core/TestFromClass.java b/sunshine-core/src/main/java/org/tatools/sunshine/core/TestFromClass.java index 3f39768..268cd0b 100644 --- a/sunshine-core/src/main/java/org/tatools/sunshine/core/TestFromClass.java +++ b/sunshine-core/src/main/java/org/tatools/sunshine/core/TestFromClass.java @@ -9,7 +9,7 @@ * @version $Id$ */ @EqualsAndHashCode -public final class TestFromClass implements SunshineTest { +public class TestFromClass implements SunshineTest { private final Class origin; /** @@ -22,17 +22,17 @@ public TestFromClass(Class testClass) { } @Override - public Class object() throws TestException { + public final Class object() throws TestException { return this.origin; } @Override - public boolean match(Condition condition) { + public final boolean match(Condition condition) { return condition.applicable(this.toString()); } @Override - public String toString() { + public final String toString() { return this.origin.getName(); } } 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 1cabe8d..8cdf59c 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 @@ -9,7 +9,7 @@ * @version $Id$ */ @EqualsAndHashCode -public final class TestFromFile implements SunshineTest { +public class TestFromFile implements SunshineTest { private final String path; /** @@ -23,7 +23,7 @@ public TestFromFile(String path) { } @Override - public Class object() throws TestException { + public final Class object() throws TestException { try { return Class.forName(toString()); } catch (ClassNotFoundException e) { @@ -32,12 +32,12 @@ public Class object() throws TestException { } @Override - public boolean match(Condition condition) { + public final boolean match(Condition condition) { return condition.applicable(this.toString()); } @Override - public String toString() { + public final String toString() { return path.replaceAll("[/\\\\]", ".").replaceFirst("^\\.", "").replace(".class", ""); } } 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 2a1fbe9..5d9d716 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 @@ -11,7 +11,7 @@ * @version $Id$ * @since 0.3.0 */ -public final class VerboseRegex implements Condition { +public class VerboseRegex implements Condition { private final RegexCondition regexCondition; private final boolean[] say = new boolean[]{true}; @@ -38,7 +38,7 @@ public VerboseRegex(RegexCondition condition) { } @Override - public boolean applicable(String identity) { + public final boolean applicable(String identity) { if (say[0]) { this.printer.println( String.format( 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 458dab1..342eb93 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 @@ -14,7 +14,7 @@ * @version $Id$ * @since 0.1 */ -public final class Junit4Kernel implements Kernel { +public class Junit4Kernel implements Kernel { private final JUnitCore junit; private final Suite[]> suiteForRun; @@ -41,7 +41,7 @@ private Junit4Kernel(JUnitCore jUnitCore, Suite[]> suite) { * @throws KernelException if any error occurs during JUnit tests execution. */ @Override - public Status status() throws KernelException { + public final Status status() throws KernelException { try { return new JunitStatus(this.junit.run(new Computer(), this.suiteForRun.tests())); } catch (SuiteException e) { @@ -56,7 +56,7 @@ public Status status() throws KernelException { * @return the new instance of the JUnit kernel */ @Override - public Junit4Kernel with(RunListener... listeners) { + public final Junit4Kernel with(RunListener... listeners) { final JUnitCore jUnitCore = new JUnitCore(); Arrays.stream(listeners).forEach(jUnitCore::addListener); return new Junit4Kernel(jUnitCore, this.suiteForRun); 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 a831091..cf69a5c 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 @@ -10,7 +10,7 @@ * @version $Id$ * @since 0.2 */ -public final class JunitStatus implements Status { +public class JunitStatus implements Status { private final Result status; @@ -25,7 +25,7 @@ public JunitStatus(Result result) { } @Override - public short code() { + public final short code() { if (this.status.wasSuccessful()) { return (short) 0; } @@ -33,17 +33,17 @@ public short code() { } @Override - public int runCount() { + public final int runCount() { return status.getRunCount(); } @Override - public int failureCount() { + public final int failureCount() { return status.getFailureCount(); } @Override - public int ignoreCount() { + public final int ignoreCount() { return status.getIgnoreCount(); } } 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 061cb3b..754e645 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 @@ -12,7 +12,7 @@ * @version $Id$ * @since 0.1 */ -public final class JunitSuite implements Suite[]> { +public class JunitSuite implements Suite[]> { private final SunshineSuite suite; @@ -50,7 +50,7 @@ public JunitSuite(SunshineSuite classesAsSuite) { } @Override - public Class[] tests() throws SuiteException { + public final Class[] tests() throws SuiteException { List> tests = new ArrayList<>(); for (SunshineTest test : this.suite.tests()) { try { 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 7380ea2..c368ffa 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 @@ -15,7 +15,7 @@ * @since 0.1 */ @SuppressWarnings("WeakerAccess") -public final class LoadableTestNGSuite implements TestNGSuite { +public class LoadableTestNGSuite implements TestNGSuite { private static final String SUNSHINE_SUITE = "Sunshine suite"; private final String name; @@ -192,7 +192,7 @@ public LoadableTestNGSuite(String suiteName, SunshineSuite suite, File xmlFileNa } @Override - public File tests() throws SuiteException { + public final File tests() throws SuiteException { XmlSuite xmlSuite = new XmlSuite(); xmlSuite.setName(this.name); try { diff --git a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/PreparedTestNGSuite.java b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/PreparedTestNGSuite.java index a6dbbe0..ee0f57f 100644 --- a/sunshine-testng/src/main/java/org/tatools/sunshine/testng/PreparedTestNGSuite.java +++ b/sunshine-testng/src/main/java/org/tatools/sunshine/testng/PreparedTestNGSuite.java @@ -8,7 +8,7 @@ * @version $Id$ * @since 0.1 */ -public final class PreparedTestNGSuite implements TestNGSuite { +public class PreparedTestNGSuite implements TestNGSuite { private final FileSystemPath fileSystemPath; @@ -21,7 +21,7 @@ public PreparedTestNGSuite(FileSystemPath fileSystemPath) { } @Override - public FileSystemPath tests() { + public final FileSystemPath tests() { return fileSystemPath; } } 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 eae6663..d502e3c 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 @@ -17,7 +17,7 @@ * @version $Id$ * @since 0.2 */ -public final class TestNGKernel implements Kernel { +public class TestNGKernel implements Kernel { private final TestNG engine; private final TestNGSuite suite; @@ -37,7 +37,7 @@ public TestNGKernel(TestNGSuite tests) { @Override - public Status status() throws KernelException { + public final Status status() throws KernelException { try { this.suites.clear(); this.engine.setTestSuites(Collections.singletonList(this.suite.tests().path().toString())); @@ -55,7 +55,7 @@ public Status status() throws KernelException { * @return an instance of {@link TestNGKernel} */ @Override - public TestNGKernel with(ITestNGListener... listeners) { + public final TestNGKernel with(ITestNGListener... listeners) { final TestNGKernel kernel = new TestNGKernel(this.suite); Arrays.stream(listeners).forEach(kernel.engine::addListener); return kernel; 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 8295356..306f659 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 @@ -15,7 +15,7 @@ * @version $Id$ * @since 0.2 */ -public final class TestNGStatus implements Status { +public class TestNGStatus implements Status { private final short exit_code; private final List reports; @@ -27,26 +27,25 @@ public TestNGStatus(int status, List suites) { this.counts = new ArrayList<>(3); } - @Override - public short code() { + public final short code() { return this.exit_code; } @Override - public int runCount() { + public final int runCount() { this.calculate(); return this.counts.get(0).intValue(); } @Override - public int failureCount() { + public final int failureCount() { this.calculate(); return this.counts.get(1).intValue(); } @Override - public int ignoreCount() { + public final int ignoreCount() { this.calculate(); return this.counts.get(2).intValue(); }