Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/test/java/org/codehaus/plexus/util/DirectoryScannerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand All @@ -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[] {"**"});
Expand Down Expand Up @@ -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";
Expand All @@ -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,";
Expand Down Expand Up @@ -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();
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down
16 changes: 7 additions & 9 deletions src/test/java/org/codehaus/plexus/util/FileUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ void mkdir() {
FileUtils.mkdir(winFile.getAbsolutePath());
fail();
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
}
Expand Down Expand Up @@ -358,7 +357,6 @@ void forceMkdir() throws Exception {
FileUtils.forceMkdir(winFile);
fail();
} catch (IllegalArgumentException e) {
assertTrue(true);
}
}
}
Expand Down Expand Up @@ -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();
/*
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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");
Expand All @@ -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
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/codehaus/plexus/util/ReflectionUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

/**
Expand All @@ -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));
}

Expand All @@ -50,7 +50,7 @@ void simpleVariableAccess() throws IllegalAccessException {
* @throws java.lang.IllegalAccessException if any.
*/
@Test
void complexVariableAccess() throws IllegalAccessException {
void complexVariableAccess() throws Exception {
Map<String, Object> map = ReflectionUtils.getVariablesAndValuesIncludingSuperclasses(testClass);

Map myMap = (Map) map.get("myMap");
Expand All @@ -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));
}

Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

/**
* <p>CommandLineUtilsTest class.</p>
Expand All @@ -43,7 +40,7 @@ class CommandLineUtilsTest {
*/
@Test
void quoteArguments() {
Assertions.assertDoesNotThrow(() -> {
assertDoesNotThrow(() -> {
String result = CommandLineUtils.quote("Hello");
System.out.println(result);
assertEquals("Hello", result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;

/**
* <p>CycleDetectorTest class.</p>
Expand All @@ -45,7 +40,7 @@ void cycyleDetection() {
//
// a --> b --->c
//
Assertions.assertDoesNotThrow(
assertDoesNotThrow(
() -> {
final DAG dag1 = new DAG();

Expand Down Expand Up @@ -89,7 +84,7 @@ void cycyleDetection() {
// a --> b
// | | --> d
// --------->
Assertions.assertDoesNotThrow(
assertDoesNotThrow(
() -> {
final DAG dag3 = new DAG();

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/codehaus/plexus/util/dag/DAGTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down
Loading