diff --git a/src/test/java/org/codehaus/plexus/util/DirectoryScannerTest.java b/src/test/java/org/codehaus/plexus/util/DirectoryScannerTest.java index 5d12b620..dccdefc4 100644 --- a/src/test/java/org/codehaus/plexus/util/DirectoryScannerTest.java +++ b/src/test/java/org/codehaus/plexus/util/DirectoryScannerTest.java @@ -67,7 +67,7 @@ void setUp() { * @throws java.net.URISyntaxException if any. */ @Test - void crossPlatformIncludesString() throws IOException, URISyntaxException { + void crossPlatformIncludesString() throws Exception { DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(new File(getTestResourcesDir() + File.separator + "directory-scanner").getCanonicalFile()); @@ -93,7 +93,7 @@ void crossPlatformIncludesString() throws IOException, URISyntaxException { * @throws java.net.URISyntaxException if any. */ @Test - void crossPlatformExcludesString() throws IOException, URISyntaxException { + void crossPlatformExcludesString() throws Exception { DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(new File(getTestResourcesDir() + File.separator + "directory-scanner").getCanonicalFile()); ds.setIncludes(new String[] {"**"}); @@ -173,7 +173,7 @@ private boolean checkTestFilesSymlinks() { * @throws java.io.IOException if any. */ @Test - void general() throws IOException { + void general() throws Exception { this.createTestFiles(); String includes = "scanner1.dat,scanner2.dat,scanner3.dat,scanner4.dat,scanner5.dat"; @@ -193,7 +193,7 @@ void general() throws IOException { * @throws java.io.IOException if any. */ @Test - void includesExcludesWithWhiteSpaces() throws IOException { + void includesExcludesWithWhiteSpaces() throws Exception { this.createTestFiles(); String includes = "scanner1.dat,\n \n,scanner2.dat \n\r, scanner3.dat\n, \tscanner4.dat,scanner5.dat\n,"; @@ -294,7 +294,7 @@ private void createTestDirectories() throws IOException { * @throws java.io.IOException if any. */ @Test - void directoriesWithHyphens() throws IOException { + void directoriesWithHyphens() throws Exception { this.createTestDirectories(); DirectoryScanner ds = new DirectoryScanner(); @@ -316,7 +316,7 @@ void directoriesWithHyphens() throws IOException { * @throws java.io.IOException if any. */ @Test - void antExcludesOverrideIncludes() throws IOException { + void antExcludesOverrideIncludes() throws Exception { printTestHeader(); File dir = new File(testDir, "regex-dir"); @@ -354,7 +354,7 @@ void antExcludesOverrideIncludes() throws IOException { * @throws java.io.IOException if any. */ @Test - void antExcludesOverrideIncludesWithExplicitAntPrefix() throws IOException { + void antExcludesOverrideIncludesWithExplicitAntPrefix() throws Exception { printTestHeader(); File dir = new File(testDir, "regex-dir"); @@ -393,7 +393,7 @@ void antExcludesOverrideIncludesWithExplicitAntPrefix() throws IOException { * @throws java.io.IOException if any. */ @Test - void regexIncludeWithExcludedPrefixDirs() throws IOException { + void regexIncludeWithExcludedPrefixDirs() throws Exception { printTestHeader(); File dir = new File(testDir, "regex-dir"); @@ -427,7 +427,7 @@ void regexIncludeWithExcludedPrefixDirs() throws IOException { * @throws java.io.IOException if any. */ @Test - void regexExcludeWithNegativeLookahead() throws IOException { + void regexExcludeWithNegativeLookahead() throws Exception { printTestHeader(); File dir = new File(testDir, "regex-dir"); @@ -466,7 +466,7 @@ void regexExcludeWithNegativeLookahead() throws IOException { * @throws java.io.IOException if any. */ @Test - void regexWithSlashInsideCharacterClass() throws IOException { + void regexWithSlashInsideCharacterClass() throws Exception { printTestHeader(); File dir = new File(testDir, "regex-dir"); @@ -507,7 +507,7 @@ void regexWithSlashInsideCharacterClass() throws IOException { * @throws java.io.IOException if occurs an I/O error. */ @Test - void doNotScanUnnecesaryDirectories() throws IOException { + void doNotScanUnnecesaryDirectories() throws Exception { createTestDirectories(); // create additional directories 'anotherDir1', 'anotherDir2' and 'anotherDir3' with a 'file1.dat' file @@ -576,7 +576,7 @@ protected void scandir(File dir, String vpath, boolean fast) { * @throws java.io.IOException if any. */ @Test - void isSymbolicLink() throws IOException { + void isSymbolicLink() throws Exception { assumeTrue(checkTestFilesSymlinks()); final File directory = new File("src/test/resources/symlinks/src"); @@ -593,7 +593,7 @@ void isSymbolicLink() throws IOException { * @throws java.io.IOException if any. */ @Test - void isParentSymbolicLink() throws IOException { + void isParentSymbolicLink() throws Exception { assumeTrue(checkTestFilesSymlinks()); final File directory = new File("src/test/resources/symlinks/src"); diff --git a/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java b/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java index ec19eb5b..7a9ef306 100644 --- a/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/util/FileUtilsTest.java @@ -220,7 +220,6 @@ void mkdir() { FileUtils.mkdir(winFile.getAbsolutePath()); fail(); } catch (IllegalArgumentException e) { - assertTrue(true); } } } @@ -358,7 +357,6 @@ void forceMkdir() throws Exception { FileUtils.forceMkdir(winFile); fail(); } catch (IllegalArgumentException e) { - assertTrue(true); } } } @@ -1243,7 +1241,7 @@ void filteredWithoutFilterAndOlderFileAndOverwrite() throws Exception { * @throws java.io.IOException if any. */ @Test - void fileRead() throws IOException { + void fileRead() throws Exception { File testFile = new File(getTestDirectory(), "testFileRead.txt"); String testFileName = testFile.getAbsolutePath(); /* @@ -1272,7 +1270,7 @@ void fileRead() throws IOException { * @throws java.io.IOException if any. */ @Test - void fileReadWithEncoding() throws IOException { + void fileReadWithEncoding() throws Exception { String encoding = "UTF-8"; File testFile = new File(getTestDirectory(), "testFileRead.txt"); String testFileName = testFile.getAbsolutePath(); @@ -1297,7 +1295,7 @@ void fileReadWithEncoding() throws IOException { * @throws java.io.IOException if any. */ @Test - void fileAppend() throws IOException { + void fileAppend() throws Exception { String baseString = "abc"; File testFile = new File(getTestDirectory(), "testFileAppend.txt"); String testFileName = testFile.getAbsolutePath(); @@ -1322,7 +1320,7 @@ void fileAppend() throws IOException { * @throws java.io.IOException if any. */ @Test - void fileAppendWithEncoding() throws IOException { + void fileAppendWithEncoding() throws Exception { String baseString = "abc"; String encoding = "UTF-8"; File testFile = new File(getTestDirectory(), "testFileAppend.txt"); @@ -1348,7 +1346,7 @@ void fileAppendWithEncoding() throws IOException { * @throws java.io.IOException if any. */ @Test - void fileWrite() throws IOException { + void fileWrite() throws Exception { File testFile = new File(getTestDirectory(), "testFileWrite.txt"); String testFileName = testFile.getAbsolutePath(); // unicode escaped Japanese hiragana, "aiueo" + Umlaut a @@ -1364,7 +1362,7 @@ void fileWrite() throws IOException { * @throws java.io.IOException if any. */ @Test - void fileWriteWithEncoding() throws IOException { + void fileWriteWithEncoding() throws Exception { String encoding = "UTF-8"; File testFile = new File(getTestDirectory(), "testFileWrite.txt"); String testFileName = testFile.getAbsolutePath(); @@ -1422,7 +1420,7 @@ void deleteLongPathOnWindows() throws Exception { * @throws java.io.IOException if any. */ @Test - void copyFileOnSameFile() throws IOException { + void copyFileOnSameFile() throws Exception { String content = "ggrgreeeeeeeeeeeeeeeeeeeeeeeoierjgioejrgiojregioejrgufcdxivbsdibgfizgerfyaezgv!zeez"; final File theFile = File.createTempFile("test", ".txt"); theFile.deleteOnExit(); diff --git a/src/test/java/org/codehaus/plexus/util/LineOrientedInterpolatingReaderTest.java b/src/test/java/org/codehaus/plexus/util/LineOrientedInterpolatingReaderTest.java index 612d41a8..a67234ed 100644 --- a/src/test/java/org/codehaus/plexus/util/LineOrientedInterpolatingReaderTest.java +++ b/src/test/java/org/codehaus/plexus/util/LineOrientedInterpolatingReaderTest.java @@ -46,7 +46,7 @@ class LineOrientedInterpolatingReaderTest { * @throws java.io.IOException if any. */ @Test - void shouldInterpolateExpressionAtEndOfDataWithInvalidEndToken() throws IOException { + void shouldInterpolateExpressionAtEndOfDataWithInvalidEndToken() throws Exception { String testStr = "This is a ${test"; LineOrientedInterpolatingReader iReader = new LineOrientedInterpolatingReader( new StringReader(testStr), Collections.singletonMap("test", "TestValue")); diff --git a/src/test/java/org/codehaus/plexus/util/ReflectionUtilsTest.java b/src/test/java/org/codehaus/plexus/util/ReflectionUtilsTest.java index 527f7d1a..9303483c 100644 --- a/src/test/java/org/codehaus/plexus/util/ReflectionUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/util/ReflectionUtilsTest.java @@ -31,7 +31,7 @@ * @see org.codehaus.plexus.util.ReflectionUtils * @since 3.4.0 */ -public final class ReflectionUtilsTest { +final class ReflectionUtilsTest { private final ReflectionUtilsTestClass testClass = new ReflectionUtilsTestClass(); /** @@ -40,7 +40,7 @@ public final class ReflectionUtilsTest { * @throws java.lang.IllegalAccessException if any. */ @Test - void simpleVariableAccess() throws IllegalAccessException { + void simpleVariableAccess() throws Exception { assertEquals("woohoo", ReflectionUtils.getValueIncludingSuperclasses("myString", testClass)); } @@ -50,7 +50,7 @@ void simpleVariableAccess() throws IllegalAccessException { * @throws java.lang.IllegalAccessException if any. */ @Test - void complexVariableAccess() throws IllegalAccessException { + void complexVariableAccess() throws Exception { Map map = ReflectionUtils.getVariablesAndValuesIncludingSuperclasses(testClass); Map myMap = (Map) map.get("myMap"); @@ -65,7 +65,7 @@ void complexVariableAccess() throws IllegalAccessException { * @throws java.lang.IllegalAccessException if any. */ @Test - void superClassVariableAccess() throws IllegalAccessException { + void superClassVariableAccess() throws Exception { assertEquals("super-duper", ReflectionUtils.getValueIncludingSuperclasses("mySuperString", testClass)); } @@ -75,7 +75,7 @@ void superClassVariableAccess() throws IllegalAccessException { * @throws java.lang.IllegalAccessException if any. */ @Test - void settingVariableValue() throws IllegalAccessException { + void settingVariableValue() throws Exception { ReflectionUtils.setVariableValueInObject(testClass, "mySettableString", "mySetString"); assertEquals("mySetString", ReflectionUtils.getValueIncludingSuperclasses("mySettableString", testClass)); diff --git a/src/test/java/org/codehaus/plexus/util/StringUtilsTest.java b/src/test/java/org/codehaus/plexus/util/StringUtilsTest.java index 8640fa45..d03150e4 100644 --- a/src/test/java/org/codehaus/plexus/util/StringUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/util/StringUtilsTest.java @@ -323,7 +323,6 @@ void unifyLineSeparators() throws Exception { StringUtils.unifyLineSeparators(s, "abs"); fail("Exception NOT catched"); } catch (IllegalArgumentException e) { - assertTrue(true, "Exception catched"); } assertEquals("this\nis\na\ntest", StringUtils.unifyLineSeparators(s, "\n")); diff --git a/src/test/java/org/codehaus/plexus/util/cli/CommandLineUtilsTest.java b/src/test/java/org/codehaus/plexus/util/cli/CommandLineUtilsTest.java index a63adfab..f3bd1beb 100644 --- a/src/test/java/org/codehaus/plexus/util/cli/CommandLineUtilsTest.java +++ b/src/test/java/org/codehaus/plexus/util/cli/CommandLineUtilsTest.java @@ -21,12 +21,9 @@ import java.util.Properties; import org.codehaus.plexus.util.Os; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assertions.*; /** *

CommandLineUtilsTest class.

@@ -43,7 +40,7 @@ class CommandLineUtilsTest { */ @Test void quoteArguments() { - Assertions.assertDoesNotThrow(() -> { + assertDoesNotThrow(() -> { String result = CommandLineUtils.quote("Hello"); System.out.println(result); assertEquals("Hello", result); diff --git a/src/test/java/org/codehaus/plexus/util/dag/CycleDetectorTest.java b/src/test/java/org/codehaus/plexus/util/dag/CycleDetectorTest.java index e900ca83..14b38861 100644 --- a/src/test/java/org/codehaus/plexus/util/dag/CycleDetectorTest.java +++ b/src/test/java/org/codehaus/plexus/util/dag/CycleDetectorTest.java @@ -18,14 +18,9 @@ import java.util.List; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assertions.*; /** *

CycleDetectorTest class.

@@ -45,7 +40,7 @@ void cycyleDetection() { // // a --> b --->c // - Assertions.assertDoesNotThrow( + assertDoesNotThrow( () -> { final DAG dag1 = new DAG(); @@ -89,7 +84,7 @@ void cycyleDetection() { // a --> b // | | --> d // ---------> - Assertions.assertDoesNotThrow( + assertDoesNotThrow( () -> { final DAG dag3 = new DAG(); diff --git a/src/test/java/org/codehaus/plexus/util/dag/DAGTest.java b/src/test/java/org/codehaus/plexus/util/dag/DAGTest.java index 7f0cf922..bda9e91c 100644 --- a/src/test/java/org/codehaus/plexus/util/dag/DAGTest.java +++ b/src/test/java/org/codehaus/plexus/util/dag/DAGTest.java @@ -40,7 +40,7 @@ class DAGTest { * @throws org.codehaus.plexus.util.dag.CycleDetectedException if any. */ @Test - void dag() throws CycleDetectedException { + void dag() throws Exception { final DAG dag = new DAG(); dag.addVertex("a"); @@ -146,7 +146,7 @@ void dag() throws CycleDetectedException { * @throws org.codehaus.plexus.util.dag.CycleDetectedException if any. */ @Test - void getPredecessors() throws CycleDetectedException { + void getPredecessors() throws Exception { final DAG dag = new DAG(); dag.addEdge("a", "b"); diff --git a/src/test/java/org/codehaus/plexus/util/dag/TopologicalSorterTest.java b/src/test/java/org/codehaus/plexus/util/dag/TopologicalSorterTest.java index 02bd14cd..e2e18d2a 100644 --- a/src/test/java/org/codehaus/plexus/util/dag/TopologicalSorterTest.java +++ b/src/test/java/org/codehaus/plexus/util/dag/TopologicalSorterTest.java @@ -37,7 +37,7 @@ class TopologicalSorterTest { * @throws org.codehaus.plexus.util.dag.CycleDetectedException if any. */ @Test - void dfs() throws CycleDetectedException { + void dfs() throws Exception { // a --> b --->c // // result a,b,c diff --git a/src/test/java/org/codehaus/plexus/util/io/CachingOutputStreamTest.java b/src/test/java/org/codehaus/plexus/util/io/CachingOutputStreamTest.java index 11da4e05..4bfda2cc 100644 --- a/src/test/java/org/codehaus/plexus/util/io/CachingOutputStreamTest.java +++ b/src/test/java/org/codehaus/plexus/util/io/CachingOutputStreamTest.java @@ -60,7 +60,7 @@ private void waitLastModified() throws IOException, InterruptedException { } @Test - void writeNoExistingFile() throws IOException, InterruptedException { + void writeNoExistingFile() throws Exception { byte[] data = "Hello world!".getBytes(StandardCharsets.UTF_8); Path path = tempDir.resolve("file.txt"); assertFalse(Files.exists(path)); diff --git a/src/test/java/org/codehaus/plexus/util/io/CachingWriterTest.java b/src/test/java/org/codehaus/plexus/util/io/CachingWriterTest.java index 5172547b..ab52ca10 100644 --- a/src/test/java/org/codehaus/plexus/util/io/CachingWriterTest.java +++ b/src/test/java/org/codehaus/plexus/util/io/CachingWriterTest.java @@ -60,7 +60,7 @@ private void waitLastModified() throws IOException, InterruptedException { } @Test - void noOverwriteWithFlush() throws IOException, InterruptedException { + void noOverwriteWithFlush() throws Exception { String data = "Hello world!"; Path path = tempDir.resolve("file-bigger.txt"); assertFalse(Files.exists(path)); @@ -85,7 +85,7 @@ void noOverwriteWithFlush() throws IOException, InterruptedException { } @Test - void writeNoExistingFile() throws IOException, InterruptedException { + void writeNoExistingFile() throws Exception { String data = "Hello world!"; Path path = tempDir.resolve("file.txt"); assertFalse(Files.exists(path));