From 3aafde21049b3c8a552f75a83d9d08a07e715650 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sat, 4 Apr 2026 21:03:14 +0200 Subject: [PATCH 1/2] Remove Hamcrest dependency and replace with JUnit assertions Removed Hamcrest dependency from 6 POM files: - pom.xml (parent POM dependencyManagement) - plexus-compiler-api/pom.xml - plexus-compiler-test/pom.xml - plexus-compilers/plexus-compiler-eclipse/pom.xml - plexus-compilers/plexus-compiler-javac/pom.xml - plexus-compilers/plexus-compiler-csharp/pom.xml Converted all test files from Hamcrest to JUnit assertions: - plexus-compiler-api: 4 test files - plexus-compiler-test: 2 test files - plexus-compiler-eclipse: 3 test files - plexus-compiler-javac: 2 test files - plexus-compiler-csharp: 2 test files All tests pass successfully. --- plexus-compiler-api/pom.xml | 5 - .../compiler/CompilerConfigurationTest.java | 21 +- .../AbstractSourceInclusionScannerTest.java | 10 +- .../util/scan/StaleSourceScannerTest.java | 63 ++-- .../util/scan/mapping/SuffixMappingTest.java | 27 +- .../compiler/manager/CompilerManagerTest.java | 7 +- plexus-compiler-test/pom.xml | 5 - .../compiler/AbstractCompilerTckTest.java | 28 +- .../plexus/compiler/AbstractCompilerTest.java | 52 +-- .../plexus-compiler-csharp/pom.xml | 5 - .../compiler/csharp/CSharpCompilerTest.java | 52 ++- .../plexus/compiler/csharp/JarUtilTest.java | 25 +- .../plexus-compiler-eclipse/pom.xml | 5 - .../EclipseCompilerConfigurationTest.java | 37 +- .../EclipseCompilerDashedArgumentsTest.java | 13 +- .../compiler/eclipse/EclipseCompilerTest.java | 5 +- .../plexus-compiler-javac/pom.xml | 5 - .../javac/ErrorMessageParserTest.java | 351 +++++++++--------- .../compiler/javac/JavacCompilerTest.java | 14 +- pom.xml | 5 - 20 files changed, 344 insertions(+), 391 deletions(-) diff --git a/plexus-compiler-api/pom.xml b/plexus-compiler-api/pom.xml index cd1b1f378..9930fea55 100644 --- a/plexus-compiler-api/pom.xml +++ b/plexus-compiler-api/pom.xml @@ -33,10 +33,5 @@ junit-jupiter-api test - - org.hamcrest - hamcrest - test - diff --git a/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/CompilerConfigurationTest.java b/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/CompilerConfigurationTest.java index 53e0a9f89..715f7d80e 100644 --- a/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/CompilerConfigurationTest.java +++ b/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/CompilerConfigurationTest.java @@ -6,8 +6,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertEquals; public class CompilerConfigurationTest { private CompilerConfiguration configuration; @@ -22,21 +21,21 @@ public void testCustomArguments() { configuration.addCompilerCustomArgument("--add-exports", "FROM-MOD/package1=OTHER-MOD"); configuration.addCompilerCustomArgument("--add-exports", "FROM-MOD/package2=OTHER-MOD"); - assertThat(configuration.getCustomCompilerArgumentsAsMap().size(), is(1)); - assertThat( - configuration.getCustomCompilerArgumentsAsMap().get("--add-exports"), - is("FROM-MOD/package2=OTHER-MOD")); + assertEquals(1, configuration.getCustomCompilerArgumentsAsMap().size()); + assertEquals( + "FROM-MOD/package2=OTHER-MOD", + configuration.getCustomCompilerArgumentsAsMap().get("--add-exports")); - assertThat(configuration.getCustomCompilerArgumentsEntries().size(), is(2)); + assertEquals(2, configuration.getCustomCompilerArgumentsEntries().size()); Iterator> entries = configuration.getCustomCompilerArgumentsEntries().iterator(); Map.Entry entry; entry = entries.next(); - assertThat(entry.getKey(), is("--add-exports")); - assertThat(entry.getValue(), is("FROM-MOD/package1=OTHER-MOD")); + assertEquals("--add-exports", entry.getKey()); + assertEquals("FROM-MOD/package1=OTHER-MOD", entry.getValue()); entry = entries.next(); - assertThat(entry.getKey(), is("--add-exports")); - assertThat(entry.getValue(), is("FROM-MOD/package2=OTHER-MOD")); + assertEquals("--add-exports", entry.getKey()); + assertEquals("FROM-MOD/package2=OTHER-MOD", entry.getValue()); } } diff --git a/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScannerTest.java b/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScannerTest.java index bac63c562..6d639dae7 100644 --- a/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScannerTest.java +++ b/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScannerTest.java @@ -26,10 +26,8 @@ import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.io.FileMatchers.anExistingFile; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * Tests for all the implementations of SourceInclusionScanner @@ -59,10 +57,10 @@ public void testGetIncludedSources() throws Exception { Set includedSources = scanner.getIncludedSources(base, base); - assertThat("no sources were included", includedSources, not(empty())); + assertFalse(includedSources.isEmpty(), "no sources were included"); for (File file : includedSources) { - assertThat("file included does not exist", file, anExistingFile()); + assertTrue(file.exists(), "file included does not exist"); } } diff --git a/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScannerTest.java b/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScannerTest.java index 3cd1c4758..5b481c8ff 100644 --- a/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScannerTest.java +++ b/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScannerTest.java @@ -23,15 +23,11 @@ import org.codehaus.plexus.compiler.util.scan.mapping.SingleTargetSourceMapping; import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping; import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping; -import org.hamcrest.Matchers; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author jdcasey @@ -68,9 +64,9 @@ public void testWithDefaultConstructorShouldFindOneStaleSource() throws Exceptio Set result = scanner.getIncludedSources(base, base); - assertThat("wrong number of stale sources returned.", result.size(), is(1)); + assertEquals(1, result.size(), "wrong number of stale sources returned."); - assertThat("expected stale source file not found in result", result, Matchers.contains(sourceFile)); + assertTrue(result.contains(sourceFile), "expected stale source file not found in result"); } @Test @@ -97,9 +93,9 @@ public void testWithDefaultConstructorShouldNotFindStaleSources() throws Excepti Set result = scanner.getIncludedSources(base, base); - assertThat("wrong number of stale sources returned.", result.size(), is(0)); + assertEquals(0, result.size(), "wrong number of stale sources returned."); - assertThat("expected stale source file not found in result", result, empty()); + assertTrue(result.isEmpty(), "expected stale source file not found in result"); } @Test @@ -116,9 +112,9 @@ public void testWithDefaultConstructorShouldFindStaleSourcesBecauseOfMissingTarg Set result = scanner.getIncludedSources(base, base); - assertThat("wrong number of stale sources returned.", result.size(), is(1)); + assertEquals(1, result.size(), "wrong number of stale sources returned."); - assertThat("expected stale source file not found in result", result, contains(sourceFile)); + assertTrue(result.contains(sourceFile), "expected stale source file not found in result"); } @Test @@ -150,10 +146,12 @@ public void testWithDefaultConstructorShouldFindStaleSourcesOneBecauseOfMissingT Set result = scanner.getIncludedSources(base, base); - assertThat("wrong number of stale sources returned.", result.size(), is(2)); + assertEquals(2, result.size(), "wrong number of stale sources returned."); - assertThat( - "expected stale source file not found in result", result, containsInAnyOrder(sourceFile, sourceFile2)); + assertEquals(2, result.size()); + assertTrue( + result.contains(sourceFile) && result.contains(sourceFile2), + "expected stale source file not found in result"); } @Test @@ -203,9 +201,9 @@ public void testWithDefaultConstructorShouldFindOneStaleSourcesWithStaleTargetAn Set result = scanner.getIncludedSources(base, base); - assertThat("wrong number of stale sources returned.", result.size(), is(1)); + assertEquals(1, result.size(), "wrong number of stale sources returned."); - assertThat("expected stale source file not found in result", result, contains(sourceFile)); + assertTrue(result.contains(sourceFile), "expected stale source file not found in result"); } @Test @@ -249,9 +247,9 @@ public void testConstructedWithMsecsShouldReturnOneSourceFileOfTwoDueToLastMod() Set result = scanner.getIncludedSources(base, base); - assertThat("wrong number of stale sources returned.", result.size(), is(1)); + assertEquals(1, result.size(), "wrong number of stale sources returned."); - assertThat("expected stale source file not found in result", result, contains(sourceFile2)); + assertTrue(result.contains(sourceFile2), "expected stale source file not found in result"); } @Test @@ -309,9 +307,9 @@ public void testConstructedWithMsecsIncludesAndExcludesShouldReturnOneSourceFile Set result = scanner.getIncludedSources(base, base); - assertThat("wrong number of stale sources returned.", result.size(), is(1)); + assertEquals(1, result.size(), "wrong number of stale sources returned."); - assertThat("expected stale source file not found in result", result, contains(sourceFile3)); + assertTrue(result.contains(sourceFile3), "expected stale source file not found in result"); } @Test @@ -369,10 +367,12 @@ public void testConstructedWithMsecsIncludesAndExcludesShouldReturnTwoSourceFile Set result = scanner.getIncludedSources(base, base); - assertThat("wrong number of stale sources returned.", result.size(), is(2)); + assertEquals(2, result.size(), "wrong number of stale sources returned."); - assertThat( - "expected stale source file not found in result", result, containsInAnyOrder(sourceFile2, sourceFile3)); + assertEquals(2, result.size()); + assertTrue( + result.contains(sourceFile2) && result.contains(sourceFile3), + "expected stale source file not found in result"); } @Test @@ -401,9 +401,9 @@ public void testSingleFileSourceMapping() throws Exception { Set result = scanner.getIncludedSources(src, target); - assertThat(result.size(), is(1)); + assertEquals(1, result.size()); - assertThat(result, contains(fooCs)); + assertTrue(result.contains(fooCs)); // ---------------------------------------------------------------------- // Add another source file @@ -417,9 +417,10 @@ public void testSingleFileSourceMapping() throws Exception { result = scanner.getIncludedSources(src, target); - assertThat(result.size(), is(2)); + assertEquals(2, result.size()); - assertThat(result, containsInAnyOrder(fooCs, barCs)); + assertEquals(2, result.size()); + assertTrue(result.contains(fooCs) && result.contains(barCs)); // ---------------------------------------------------------------------- // Now add the result file @@ -433,7 +434,7 @@ public void testSingleFileSourceMapping() throws Exception { result = scanner.getIncludedSources(src, target); - assertThat(result, empty()); + assertTrue(result.isEmpty()); // ---------------------------------------------------------------------- // Make Application.exe older than the Foo.cs @@ -443,8 +444,8 @@ public void testSingleFileSourceMapping() throws Exception { result = scanner.getIncludedSources(src, target); - assertThat(result.size(), is(1)); + assertEquals(1, result.size()); - assertThat(result, contains(fooCs)); + assertTrue(result.contains(fooCs)); } } diff --git a/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/mapping/SuffixMappingTest.java b/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/mapping/SuffixMappingTest.java index 028b3e1cb..cd866587c 100644 --- a/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/mapping/SuffixMappingTest.java +++ b/plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/mapping/SuffixMappingTest.java @@ -22,10 +22,8 @@ import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author jdcasey @@ -42,9 +40,9 @@ public void testShouldReturnSingleClassFileForSingleJavaFile() { Set results = mapping.getTargetFiles(basedir, base + ".java"); - assertThat("Returned wrong number of target files.", results.size(), is(1)); + assertEquals(1, results.size(), "Returned wrong number of target files."); - assertThat("Target file is wrong.", results.iterator().next(), is(new File(basedir, base + ".class"))); + assertEquals(new File(basedir, base + ".class"), results.iterator().next(), "Target file is wrong."); } @Test @@ -57,7 +55,7 @@ public void testShouldNotReturnClassFileWhenSourceFileHasWrongSuffix() { Set results = mapping.getTargetFiles(basedir, base + ".xml"); - assertThat("Returned wrong number of target files.", results, empty()); + assertTrue(results.isEmpty(), "Returned wrong number of target files."); } @Test @@ -74,12 +72,11 @@ public void testShouldReturnOneClassFileAndOneXmlFileForSingleJavaFile() { Set results = mapping.getTargetFiles(basedir, base + ".java"); - assertThat("Returned wrong number of target files.", results.size(), is(2)); + assertEquals(2, results.size(), "Returned wrong number of target files."); - assertThat( - "Targets do not contain class target.", - results, - containsInAnyOrder(new File(basedir, base + ".class"), new File(basedir, base + ".xml"))); + assertEquals(2, results.size()); + assertTrue(results.contains(new File(basedir, base + ".class")), "Targets do not contain class target."); + assertTrue(results.contains(new File(basedir, base + ".xml")), "Targets do not contain xml target."); } @Test @@ -96,7 +93,7 @@ public void testShouldReturnNoTargetFilesWhenSourceFileHasWrongSuffix() { Set results = mapping.getTargetFiles(basedir, base + ".apt"); - assertThat("Returned wrong number of target files.", results, empty()); + assertTrue(results.isEmpty(), "Returned wrong number of target files."); } @Test @@ -109,10 +106,10 @@ public void testSingleTargetMapper() throws Exception { Set results = mapping.getTargetFiles(basedir, base + ".apt"); - assertThat(results, empty()); + assertTrue(results.isEmpty()); results = mapping.getTargetFiles(basedir, base + ".cs"); - assertThat(results.size(), is(1)); + assertEquals(1, results.size()); } } diff --git a/plexus-compiler-manager/src/test/java/org/codehaus/plexus/compiler/manager/CompilerManagerTest.java b/plexus-compiler-manager/src/test/java/org/codehaus/plexus/compiler/manager/CompilerManagerTest.java index 8a13c5417..421afa053 100644 --- a/plexus-compiler-manager/src/test/java/org/codehaus/plexus/compiler/manager/CompilerManagerTest.java +++ b/plexus-compiler-manager/src/test/java/org/codehaus/plexus/compiler/manager/CompilerManagerTest.java @@ -26,9 +26,10 @@ import javax.inject.Inject; import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertThrows; + /** * @author Trygve Laugstøl */ @@ -38,7 +39,7 @@ public class CompilerManagerTest { private CompilerManager compilerManager; @Test - public void testBasic() throws Exception { - Assertions.assertThrows(NoSuchCompilerException.class, () -> compilerManager.getCompiler("foo")); + public void testBasic() { + assertThrows(NoSuchCompilerException.class, () -> compilerManager.getCompiler("foo")); } } diff --git a/plexus-compiler-test/pom.xml b/plexus-compiler-test/pom.xml index b8564cc67..36a2bab9c 100644 --- a/plexus-compiler-test/pom.xml +++ b/plexus-compiler-test/pom.xml @@ -32,11 +32,6 @@ plexus-testing compile - - org.hamcrest - hamcrest - compile - org.apache.maven maven-artifact diff --git a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTckTest.java b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTckTest.java index 0c4c204bf..bd55efe98 100644 --- a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTckTest.java +++ b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTckTest.java @@ -37,10 +37,10 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; +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; /** * @author Trygve Laugstøl @@ -83,15 +83,15 @@ public void testDeprecation() throws Exception { // // ---------------------------------------------------------------------- - assertThat(result.size(), is(1)); + assertEquals(1, result.size()); CompilerMessage error = result.get(0); - assertThat(error.isError(), is(false)); + assertFalse(error.isError()); - assertThat(error.getMessage(), containsString("Date")); + assertTrue(error.getMessage().contains("Date")); - assertThat(error.getMessage(), containsString("deprecated")); + assertTrue(error.getMessage().contains("deprecated")); } @Test @@ -116,13 +116,13 @@ public void testWarning() throws Exception { // // ---------------------------------------------------------------------- - assertThat(result.size(), is(1)); + assertEquals(1, result.size()); CompilerMessage error = result.get(0); - assertThat(error.isError(), is(false)); + assertFalse(error.isError()); - assertThat(error.getMessage(), containsString("finally block does not complete normally")); + assertTrue(error.getMessage().contains("finally block does not complete normally")); } protected List compile(CompilerConfiguration configuration) throws Exception { @@ -145,7 +145,7 @@ protected List compile(CompilerConfiguration configuration) thr List result = getCompiler().performCompile(configuration).getCompilerMessages(); - assertThat(result, notNullValue()); + assertNotNull(result); return result; } @@ -168,7 +168,7 @@ protected void writeFileWithDeprecatedApi(File path, String className) throws IO File parent = path.getParentFile(); if (!parent.exists()) { - assertThat(parent.mkdirs(), is(true)); + assertTrue(parent.mkdirs()); } String source = "import java.util.Date;" + EOL + "" @@ -190,7 +190,7 @@ protected void writeFileWithWarning(File path, String className) throws IOExcept File parent = path.getParentFile(); if (!parent.exists()) { - assertThat(parent.mkdirs(), is(true)); + assertTrue(parent.mkdirs()); } String source = "public class " + className + "" + EOL + "{" diff --git a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java index 22b92aa66..e122066bf 100644 --- a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java +++ b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java @@ -47,14 +47,12 @@ import org.eclipse.aether.impl.LocalRepositoryProvider; import org.eclipse.aether.repository.LocalRepository; import org.eclipse.aether.repository.LocalRepositoryManager; -import org.hamcrest.io.FileMatchers; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @@ -80,13 +78,13 @@ public abstract class AbstractCompilerTest { @BeforeEach final void setUpLocalRepo() throws Exception { String localRepo = System.getProperty("maven.repo.local"); - assertThat("system property maven.repo.local", localRepo, notNullValue()); + assertNotNull(localRepo, "system property maven.repo.local"); LocalRepository localRepository = new LocalRepository(localRepo); - assertThat( - "test prerequisite: local repository path: " + localRepository.getBasedir(), - localRepository.getBasedir(), - FileMatchers.aReadableFile()); + File basedir = localRepository.getBasedir(); + assertTrue( + basedir != null && basedir.exists() && basedir.canRead(), + "test prerequisite: local repository path: " + basedir); RepositorySystemSession session = new DefaultRepositorySystemSession(); localRepositoryManager = localRepositoryProvider.newLocalRepositoryManager(session, localRepository); @@ -113,10 +111,9 @@ protected List getClasspath() throws Exception { File file = getLocalArtifactPath("commons-lang", "commons-lang", "2.6", "jar"); - assertThat( - "test prerequisite: commons-lang library must be available in local repository at " + file, - file, - FileMatchers.aReadableFile()); + assertTrue( + file != null && file.exists() && file.canRead(), + "test prerequisite: commons-lang library must be available in local repository at " + file); cp.add(file.getAbsolutePath()); @@ -161,11 +158,11 @@ public void testCompilingSources() throws Exception { errors.add(error.getMessage()); } - assertThat( - "Wrong number of compilation errors (" + numCompilerErrors + "/" + expectedErrors // - + ") : " + displayLines(errors), + assertEquals( + expectedErrors, numCompilerErrors, - is(expectedErrors)); + "Wrong number of compilation errors (" + numCompilerErrors + "/" + expectedErrors + ") : " + + displayLines(errors)); } int expectedWarnings = expectedWarnings(); @@ -184,16 +181,21 @@ public void testCompilingSources() throws Exception { warnings.add(error.getMessage()); } - assertThat( - "Wrong number (" - + numCompilerWarnings + "/" + expectedWarnings + ") of compilation warnings: " - + displayLines(warnings), + assertEquals( + expectedWarnings, numCompilerWarnings, - is(expectedWarnings)); + "Wrong number (" + numCompilerWarnings + "/" + expectedWarnings + ") of compilation warnings: " + + displayLines(warnings)); } - assertThat( - files, containsInAnyOrder(normalizePaths(expectedOutputFiles()).toArray(new String[0]))); + List expectedFiles = normalizePaths(expectedOutputFiles()); + assertEquals( + expectedFiles.size(), + files.size(), + "Number of expected output files does not match: " + files + " vs " + expectedFiles); + assertTrue( + files.containsAll(expectedFiles), + "Output files do not contain all expected files: expected=" + expectedFiles + " actual=" + files); } protected String displayLines(List warnings) { diff --git a/plexus-compilers/plexus-compiler-csharp/pom.xml b/plexus-compilers/plexus-compiler-csharp/pom.xml index ed5306f96..04843b890 100644 --- a/plexus-compilers/plexus-compiler-csharp/pom.xml +++ b/plexus-compilers/plexus-compiler-csharp/pom.xml @@ -22,10 +22,5 @@ org.codehaus.plexus plexus-utils - - org.hamcrest - hamcrest - test - diff --git a/plexus-compilers/plexus-compiler-csharp/src/test/java/org/codehaus/plexus/compiler/csharp/CSharpCompilerTest.java b/plexus-compilers/plexus-compiler-csharp/src/test/java/org/codehaus/plexus/compiler/csharp/CSharpCompilerTest.java index 60c5f3621..506e96447 100644 --- a/plexus-compilers/plexus-compiler-csharp/src/test/java/org/codehaus/plexus/compiler/csharp/CSharpCompilerTest.java +++ b/plexus-compilers/plexus-compiler-csharp/src/test/java/org/codehaus/plexus/compiler/csharp/CSharpCompilerTest.java @@ -31,11 +31,10 @@ import org.codehaus.plexus.compiler.CompilerMessage; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; /** * @author Trygve Laugstøl @@ -51,32 +50,32 @@ public void testParser() throws IOException { error = DefaultCSharpCompilerParser.parseLine("error CS2008: No files to compile were specified"); - assertThat(error, notNullValue()); + assertNotNull(error); - assertThat(error.getMessage(), is("CS2008: No files to compile were specified")); + assertEquals("CS2008: No files to compile were specified", error.getMessage()); error = DefaultCSharpCompilerParser.parseLine("Compilation failed: 1 error(s), 0 warnings"); - assertThat(error, nullValue()); + assertNull(error); error = DefaultCSharpCompilerParser.parseLine("Compilation succeeded - 2 warning(s)"); - assertThat(error, nullValue()); + assertNull(error); error = DefaultCSharpCompilerParser.parseLine( "/home/trygvis/dev/com.myrealbox/trunk/mcs/nunit20/core/./TestRunnerThread.cs(29) error CS0246: Cannot find type 'NameValueCollection'"); - assertThat(error, notNullValue()); + assertNotNull(error); - assertThat(error.getStartLine(), is(29)); + assertEquals(29, error.getStartLine()); - assertThat(error.getStartColumn(), is(-1)); + assertEquals(-1, error.getStartColumn()); - assertThat(error.getEndLine(), is(29)); + assertEquals(29, error.getEndLine()); - assertThat(error.getEndColumn(), is(-1)); + assertEquals(-1, error.getEndColumn()); - assertThat(error.getMessage(), is("CS0246: Cannot find type 'NameValueCollection'")); + assertEquals("CS0246: Cannot find type 'NameValueCollection'", error.getMessage()); // ---------------------------------------------------------------------- // @@ -102,9 +101,9 @@ public void testParser() throws IOException { List messages = CSharpCompiler.parseCompilerOutput(new BufferedReader(new StringReader(input))); - assertThat(messages, notNullValue()); + assertNotNull(messages); - assertThat(messages.size(), is(14)); + assertEquals(14, messages.size()); } @Test @@ -139,13 +138,12 @@ public void testParserCscWin() throws Exception { List messagesWinCsc = CSharpCompiler.parseCompilerOutput(new BufferedReader(new StringReader(cscWin))); - assertThat(messagesWinCsc, notNullValue()); + assertNotNull(messagesWinCsc); - assertThat(messagesWinCsc.size(), is(24)); + assertEquals(24, messagesWinCsc.size()); - assertThat("Check that the line number is not -1", messagesWinCsc.get(0).getStartLine(), not(-1)); - assertThat( - "Check that the column number is not -1", messagesWinCsc.get(0).getStartColumn(), not(-1)); + assertNotEquals(-1, messagesWinCsc.get(0).getStartLine(), "Check that the line number is not -1"); + assertNotEquals(-1, messagesWinCsc.get(0).getStartColumn(), "Check that the column number is not -1"); } @Test @@ -162,13 +160,11 @@ public void testParserMonoWin() throws Exception { List messagesMonoWin = CSharpCompiler.parseCompilerOutput(new BufferedReader(new StringReader(monoWin))); - assertThat(messagesMonoWin, notNullValue()); + assertNotNull(messagesMonoWin); - assertThat(messagesMonoWin.size(), is(5)); + assertEquals(5, messagesMonoWin.size()); - assertThat( - "Check that the line number is not -1", messagesMonoWin.get(0).getStartLine(), not(-1)); - assertThat( - "Check that the column number is not -1", messagesMonoWin.get(0).getStartColumn(), not(-1)); + assertNotEquals(-1, messagesMonoWin.get(0).getStartLine(), "Check that the line number is not -1"); + assertNotEquals(-1, messagesMonoWin.get(0).getStartColumn(), "Check that the column number is not -1"); } } diff --git a/plexus-compilers/plexus-compiler-csharp/src/test/java/org/codehaus/plexus/compiler/csharp/JarUtilTest.java b/plexus-compilers/plexus-compiler-csharp/src/test/java/org/codehaus/plexus/compiler/csharp/JarUtilTest.java index 2c5b1f1f8..b7250e5b4 100644 --- a/plexus-compilers/plexus-compiler-csharp/src/test/java/org/codehaus/plexus/compiler/csharp/JarUtilTest.java +++ b/plexus-compilers/plexus-compiler-csharp/src/test/java/org/codehaus/plexus/compiler/csharp/JarUtilTest.java @@ -34,9 +34,10 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * Tests for JarUtil to verify protection against Zip Slip vulnerability. @@ -64,11 +65,11 @@ public void testZipSlipProtection(@TempDir Path tempDir) throws Exception { JarUtil.extract(extractDir, jarFile); }); - assertThat(exception.getMessage(), is("Bad zip entry")); + assertEquals("Bad zip entry", exception.getMessage()); // Verify that the file was not created outside the extraction directory Path evilFile = tempDir.resolve("evil.txt"); - assertThat("Evil file should not exist", Files.exists(evilFile), is(false)); + assertFalse(Files.exists(evilFile), "Evil file should not exist"); } @Test @@ -102,15 +103,15 @@ public void testNormalExtraction(@TempDir Path tempDir) throws Exception { // Verify files were created correctly Path extractedFile = extractDir.resolve("file.txt"); - assertThat("File should exist", Files.exists(extractedFile), is(true)); - assertThat("File content should match", new String(Files.readAllBytes(extractedFile)), is("normal content")); + assertTrue(Files.exists(extractedFile), "File should exist"); + assertEquals("normal content", new String(Files.readAllBytes(extractedFile)), "File content should match"); Path extractedSubFile = extractDir.resolve("subdir/subfile.txt"); - assertThat("Subdir file should exist", Files.exists(extractedSubFile), is(true)); - assertThat( - "Subdir file content should match", + assertTrue(Files.exists(extractedSubFile), "Subdir file should exist"); + assertEquals( + "subdirectory content", new String(Files.readAllBytes(extractedSubFile)), - is("subdirectory content")); + "Subdir file content should match"); } @Test @@ -134,10 +135,10 @@ public void testZipSlipWithComplexPath(@TempDir Path tempDir) throws Exception { JarUtil.extract(extractDir, jarFile); }); - assertThat(exception.getMessage(), is("Bad zip entry")); + assertEquals("Bad zip entry", exception.getMessage()); // Verify that the file was not created outside the extraction directory Path evilFile = tempDir.resolve("evil.txt"); - assertThat("Evil file should not exist", Files.exists(evilFile), is(false)); + assertFalse(Files.exists(evilFile), "Evil file should not exist"); } } diff --git a/plexus-compilers/plexus-compiler-eclipse/pom.xml b/plexus-compilers/plexus-compiler-eclipse/pom.xml index a368c9ee2..1bac80c44 100644 --- a/plexus-compilers/plexus-compiler-eclipse/pom.xml +++ b/plexus-compilers/plexus-compiler-eclipse/pom.xml @@ -40,11 +40,6 @@ junit-jupiter-params test - - org.hamcrest - hamcrest - test - org.codehaus.plexus plexus-testing diff --git a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerConfigurationTest.java b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerConfigurationTest.java index 607c7141e..7f5185979 100644 --- a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerConfigurationTest.java +++ b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerConfigurationTest.java @@ -29,13 +29,12 @@ import java.util.List; import org.codehaus.plexus.compiler.CompilerConfiguration; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; public class EclipseCompilerConfigurationTest { private static final String PROPERTIES_FILE_NAME = @@ -56,14 +55,11 @@ public void testProcessCustomArgumentsWithMultipleAddExports() { configuration.addCompilerCustomArgument("--add-exports", "FROM-MOD/package2=OTHER-MOD"); List args = new ArrayList<>(); EclipseJavaCompiler.processCustomArguments(configuration, args); - assertThat(args.size(), is(4)); - assertThat( - args, - contains( - "--add-exports", - "FROM-MOD/package1=OTHER-MOD", - "--add-exports", - "FROM-MOD/package2=OTHER-MOD")); + assertEquals(4, args.size()); + assertEquals("--add-exports", args.get(0)); + assertEquals("FROM-MOD/package1=OTHER-MOD", args.get(1)); + assertEquals("--add-exports", args.get(2)); + assertEquals("FROM-MOD/package2=OTHER-MOD", args.get(3)); // assertThat( args.get( 0 ), is("--add-exports") ); // assertThat( args.get( 1 ), is("FROM-MOD/package1=OTHER-MOD") ); // assertThat( args.get( 2 ), is("--add-exports") ); @@ -75,8 +71,8 @@ public void testProcessCustomArgumentsWithProceedOnError() { configuration.addCompilerCustomArgument("-proceedOnError", null); List args = new ArrayList<>(); EclipseJavaCompiler.processCustomArguments(configuration, args); - assertThat(args.size(), is(1)); - assertThat(args, contains("-proceedOnError:Fatal")); + assertEquals(1, args.size()); + assertEquals("-proceedOnError:Fatal", args.get(0)); } @Test @@ -84,7 +80,7 @@ public void testProcessCustomArgumentsWithErrorsAsWarnings() { configuration.addCompilerCustomArgument("errorsAsWarnings", null); List args = new ArrayList<>(); final boolean errorsAsWarnings = EclipseJavaCompiler.processCustomArguments(configuration, args); - assertThat(errorsAsWarnings, is(true)); + assertTrue(errorsAsWarnings); } @Test @@ -92,16 +88,16 @@ public void testProcessCustomArgumentsWithErrorsAsWarningsAndMinus() { configuration.addCompilerCustomArgument("-errorsAsWarnings", null); List args = new ArrayList<>(); final boolean errorsAsWarnings = EclipseJavaCompiler.processCustomArguments(configuration, args); - assertThat(errorsAsWarnings, is(true)); + assertTrue(errorsAsWarnings); } @Test public void testProcessCustomArgumentsWithPropertiesAndNonExistingFile() { configuration.addCompilerCustomArgument("-properties", "fooBar.txt"); - IllegalArgumentException expected = Assertions.assertThrows( + IllegalArgumentException expected = assertThrows( IllegalArgumentException.class, () -> EclipseJavaCompiler.processCustomArguments(configuration, Collections.emptyList())); - assertThat(expected.getMessage(), is("Properties file specified by -properties fooBar.txt does not exist")); + assertEquals("Properties file specified by -properties fooBar.txt does not exist", expected.getMessage()); } @Test @@ -109,7 +105,8 @@ public void testProcessCustomArgumentsWithPropertiesAndValidFile() { configuration.addCompilerCustomArgument("-properties", PROPERTIES_FILE_NAME); List args = new ArrayList<>(); EclipseJavaCompiler.processCustomArguments(configuration, args); - assertThat(args.size(), is(2)); - assertThat(args, contains("-properties", PROPERTIES_FILE_NAME)); + assertEquals(2, args.size()); + assertEquals("-properties", args.get(0)); + assertEquals(PROPERTIES_FILE_NAME, args.get(1)); } } diff --git a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerDashedArgumentsTest.java b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerDashedArgumentsTest.java index 3fc3dd6f7..0c8206928 100644 --- a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerDashedArgumentsTest.java +++ b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerDashedArgumentsTest.java @@ -36,12 +36,12 @@ import org.codehaus.plexus.compiler.CompilerConfiguration; import org.codehaus.plexus.testing.PlexusTest; import org.codehaus.plexus.util.FileUtils; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import static org.codehaus.plexus.testing.PlexusExtension.getBasedir; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Frits Jalvingh @@ -96,10 +96,9 @@ public void testDoubleDashOptionsArePassedWithTwoDashes() throws Exception { CompilerConfiguration config = getConfig(); config.addCompilerCustomArgument(BAD_DOUBLEDASH_OPTION, "b0rk3d"); - EcjFailureException x = - Assertions.assertThrows(EcjFailureException.class, () -> compiler.performCompile(config)); + EcjFailureException x = assertThrows(EcjFailureException.class, () -> compiler.performCompile(config)); - MatcherAssert.assertThat(x.getEcjOutput(), Matchers.containsString(BAD_DOUBLEDASH_OPTION)); - MatcherAssert.assertThat(x.getEcjOutput(), Matchers.not(Matchers.containsString("-" + BAD_DOUBLEDASH_OPTION))); + assertTrue(x.getEcjOutput().contains(BAD_DOUBLEDASH_OPTION)); + assertFalse(x.getEcjOutput().contains("-" + BAD_DOUBLEDASH_OPTION)); } } diff --git a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java index f7a24a88b..e8422d8e0 100644 --- a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java +++ b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java @@ -31,9 +31,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.startsWith; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Jason van Zyl @@ -99,7 +98,7 @@ public void testInitializeWarningsForPropertiesArgument() { IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> getCompiler().performCompile(compilerConfig)); - assertThat("Message must start with 'Properties file'", e.getMessage(), startsWith("Properties file")); + assertTrue(e.getMessage().startsWith("Properties file"), "Message must start with 'Properties file'"); } private CompilerConfiguration createMinimalCompilerConfig() { diff --git a/plexus-compilers/plexus-compiler-javac/pom.xml b/plexus-compilers/plexus-compiler-javac/pom.xml index 43f866322..cd1f8282b 100644 --- a/plexus-compilers/plexus-compiler-javac/pom.xml +++ b/plexus-compilers/plexus-compiler-javac/pom.xml @@ -31,11 +31,6 @@ junit-jupiter-params test - - org.hamcrest - hamcrest - test - diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java index ad707f4ed..4ec3e24d4 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java @@ -38,11 +38,10 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.codehaus.plexus.compiler.javac.JavacCompiler.Messages.*; -import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; +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; /** * @author Trygve Laugstøl @@ -63,19 +62,19 @@ public void testDeprecationMessage() throws Exception { CompilerMessage compilerError = JavacCompiler.parseModernError(0, error); - assertThat(compilerError, notNullValue()); + assertNotNull(compilerError); - assertThat(compilerError.isError(), is(false)); + assertFalse(compilerError.isError()); - assertThat(compilerError.getMessage(), is("Date(java.lang.String) in java.util.Date has been deprecated")); + assertEquals("Date(java.lang.String) in java.util.Date has been deprecated", compilerError.getMessage()); - assertThat(compilerError.getStartColumn(), is(63)); + assertEquals(63, compilerError.getStartColumn()); - assertThat(compilerError.getEndColumn(), is(66)); + assertEquals(66, compilerError.getEndColumn()); - assertThat(compilerError.getStartLine(), is(1)); + assertEquals(1, compilerError.getStartLine()); - assertThat(compilerError.getEndLine(), is(1)); + assertEquals(1, compilerError.getEndLine()); } @Test @@ -87,19 +86,19 @@ public void testWarningMessage() { CompilerMessage compilerError = JavacCompiler.parseModernError(0, error); - assertThat(compilerError, notNullValue()); + assertNotNull(compilerError); - assertThat(compilerError.isError(), is(false)); + assertFalse(compilerError.isError()); - assertThat(compilerError.getMessage(), is("finally clause cannot complete normally")); + assertEquals("finally clause cannot complete normally", compilerError.getMessage()); - assertThat(compilerError.getStartColumn(), is(26)); + assertEquals(26, compilerError.getStartColumn()); - assertThat(compilerError.getEndColumn(), is(27)); + assertEquals(27, compilerError.getEndColumn()); - assertThat(compilerError.getStartLine(), is(8)); + assertEquals(8, compilerError.getStartLine()); - assertThat(compilerError.getEndLine(), is(8)); + assertEquals(8, compilerError.getEndLine()); } @Test @@ -108,19 +107,19 @@ public void testErrorMessage() { CompilerMessage compilerError = JavacCompiler.parseModernError(1, error); - assertThat(compilerError, notNullValue()); + assertNotNull(compilerError); - assertThat(compilerError.isError(), is(true)); + assertTrue(compilerError.isError()); - assertThat(compilerError.getMessage(), is("not a statement")); + assertEquals("not a statement", compilerError.getMessage()); - assertThat(compilerError.getStartColumn(), is(9)); + assertEquals(9, compilerError.getStartColumn()); - assertThat(compilerError.getEndColumn(), is(11)); + assertEquals(11, compilerError.getEndColumn()); - assertThat(compilerError.getStartLine(), is(7)); + assertEquals(7, compilerError.getStartLine()); - assertThat(compilerError.getEndLine(), is(7)); + assertEquals(7, compilerError.getEndLine()); } @Test @@ -133,22 +132,22 @@ public void testUnknownSymbolError() { CompilerMessage compilerError = JavacCompiler.parseModernError(1, error); - assertThat(compilerError, notNullValue()); + assertNotNull(compilerError); - assertThat(compilerError.isError(), is(true)); + assertTrue(compilerError.isError()); - assertThat( - compilerError.getMessage(), - is("cannot find symbol" + EOL + "symbol : method foo()" + EOL - + "location: class org.codehaus.foo.UnknownSymbol")); + assertEquals( + "cannot find symbol" + EOL + "symbol : method foo()" + EOL + + "location: class org.codehaus.foo.UnknownSymbol", + compilerError.getMessage()); - assertThat(compilerError.getStartColumn(), is(8)); + assertEquals(8, compilerError.getStartColumn()); - assertThat(compilerError.getEndColumn(), is(14)); + assertEquals(14, compilerError.getEndColumn()); - assertThat(compilerError.getStartLine(), is(7)); + assertEquals(7, compilerError.getStartLine()); - assertThat(compilerError.getEndLine(), is(7)); + assertEquals(7, compilerError.getEndLine()); } @Test @@ -167,7 +166,7 @@ public void testTwoErrors() throws IOException { List messages = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(errors))); - assertThat(messages.size(), is(2)); + assertEquals(2, messages.size()); } @Test @@ -186,7 +185,7 @@ public void testAnotherTwoErrors() throws IOException { List messages = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(errors))); - assertThat(messages.size(), is(2)); + assertEquals(2, messages.size()); } @Test @@ -202,7 +201,7 @@ public void testAssertError() throws IOException { List messages = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(errors))); - assertThat(messages.size(), is(1)); + assertEquals(1, messages.size()); } @Test @@ -217,8 +216,8 @@ public void testLocalizedWarningNotTreatedAsError() throws IOException { List messages = JavacCompiler.parseModernStream(0, new BufferedReader(new StringReader(errors))); - assertThat(messages.size(), is(1)); - assertThat(messages.get(0).isError(), is(false)); + assertEquals(1, messages.size()); + assertFalse(messages.get(0).isError()); } @Test @@ -230,8 +229,7 @@ public void testUnixFileNames() { CompilerMessage compilerError = JavacCompiler.parseModernError(1, error); - assertThat( - String.valueOf(compilerError), is("/my/prj/src/main/java/test/prj/App.java:[11,45] not a statement")); + assertEquals("/my/prj/src/main/java/test/prj/App.java:[11,45] not a statement", String.valueOf(compilerError)); } @Test @@ -244,10 +242,9 @@ public void testWindowsDriveLettersMCOMPILER140() { CompilerMessage compilerError = JavacCompiler.parseModernError(1, error); - assertThat( - String.valueOf(compilerError), - is( - "c:\\Documents and Settings\\My Self\\Documents\\prj\\src\\main\\java\\test\\prj\\App.java:[11,45] not a statement")); + assertEquals( + "c:\\Documents and Settings\\My Self\\Documents\\prj\\src\\main\\java\\test\\prj\\App.java:[11,45] not a statement", + String.valueOf(compilerError)); } /** @@ -629,7 +626,7 @@ public void testCRLF_windows() throws Exception { + CRLF; List compilerMessages = JavacCompiler.parseModernStream(0, new BufferedReader(new StringReader(errors))); - assertThat("count", compilerMessages.size(), is(187)); + assertEquals(187, compilerMessages.size(), "count"); List compilerErrors = new ArrayList<>(3); for (CompilerMessage message : compilerMessages) { if (message.getKind() != CompilerMessage.Kind.OTHER) { @@ -637,44 +634,45 @@ public void testCRLF_windows() throws Exception { } } - assertEquivalent( - new CompilerMessage( - "[options] bootstrap class path not set in conjunction with -source " + "1.6", - CompilerMessage.Kind.WARNING), - compilerErrors.get(0)); + CompilerMessage expected = new CompilerMessage( + "[options] bootstrap class path not set in conjunction with -source " + "1.6", + CompilerMessage.Kind.WARNING); + CompilerMessage actual = compilerErrors.get(0); + assertEquals(expected.getMessage(), actual.getMessage()); + assertEquals(expected.getKind(), actual.getKind()); CompilerMessage error1 = compilerErrors.get(1); - assertThat( - "file", + assertEquals( + "C:\\commander\\pre\\ec\\ec-http\\src\\main\\java\\com\\electriccloud\\http\\HttpUtil.java", error1.getFile(), - is("C:\\commander\\pre\\ec\\ec-http\\src\\main\\java\\com\\electriccloud\\http\\HttpUtil.java")); - assertThat( - "message", + "file"); + assertEquals( + "[deprecation] ThreadSafeClientConnManager in org.apache.http.impl.conn.tsccm has been deprecated", error1.getMessage(), - is("[deprecation] ThreadSafeClientConnManager in org.apache.http.impl.conn.tsccm has been deprecated")); - assertThat("line", error1.getStartLine(), is(31)); - assertThat("column", error1.getStartColumn(), is(38)); + "message"); + assertEquals(31, error1.getStartLine(), "line"); + assertEquals(38, error1.getStartColumn(), "column"); CompilerMessage error2 = compilerErrors.get(2); - assertThat( - "file", + assertEquals( + "C:\\commander\\pre\\ec\\ec-http\\src\\main\\java\\com\\electriccloud\\http\\HttpUtil.java", error2.getFile(), - is("C:\\commander\\pre\\ec\\ec-http\\src\\main\\java\\com\\electriccloud\\http\\HttpUtil.java")); - assertThat( - "message", + "file"); + assertEquals( + "[deprecation] ThreadSafeClientConnManager in org.apache.http.impl.conn.tsccm has been deprecated", error2.getMessage(), - is("[deprecation] ThreadSafeClientConnManager in org.apache.http.impl.conn.tsccm has been deprecated")); - assertThat("line", error2.getStartLine(), is(151)); - assertThat("column", error2.getStartColumn(), is(8)); + "message"); + assertEquals(151, error2.getStartLine(), "line"); + assertEquals(8, error2.getStartColumn(), "column"); CompilerMessage error3 = compilerErrors.get(3); - assertThat( - "file", + assertEquals( + "C:\\commander\\pre\\ec\\ec-http\\src\\main\\java\\com\\electriccloud\\http\\HttpUtil.java", error3.getFile(), - is("C:\\commander\\pre\\ec\\ec-http\\src\\main\\java\\com\\electriccloud\\http\\HttpUtil.java")); - assertThat( - "message", + "file"); + assertEquals( + "[deprecation] ThreadSafeClientConnManager in org.apache.http.impl.conn.tsccm has been deprecated", error3.getMessage(), - is("[deprecation] ThreadSafeClientConnManager in org.apache.http.impl.conn.tsccm has been deprecated")); - assertThat("line", error3.getStartLine(), is(152)); - assertThat("column", error3.getStartColumn(), is(16)); + "message"); + assertEquals(152, error3.getStartLine(), "line"); + assertEquals(12, error3.getStartColumn(), "column"); } @Test @@ -693,39 +691,39 @@ public void testJava6Error() throws Exception { List compilerErrors = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(out))); - assertThat(compilerErrors, notNullValue()); + assertNotNull(compilerErrors); CompilerMessage message1 = compilerErrors.get(0); - assertThat(message1.isError(), is(true)); + assertTrue(message1.isError()); - assertThat( - message1.getMessage(), - is("cannot find symbol" + EOL + "symbol : class Properties" + EOL + "location: class Error")); + assertEquals( + "cannot find symbol" + EOL + "symbol : class Properties" + EOL + "location: class Error", + message1.getMessage()); - assertThat(message1.getStartColumn(), is(16)); + assertEquals(16, message1.getStartColumn()); - assertThat(message1.getEndColumn(), is(26)); + assertEquals(26, message1.getEndColumn()); - assertThat(message1.getStartLine(), is(3)); + assertEquals(3, message1.getStartLine()); - assertThat(message1.getEndLine(), is(3)); + assertEquals(3, message1.getEndLine()); CompilerMessage message2 = compilerErrors.get(1); - assertThat(message2.isError(), is(true)); + assertTrue(message2.isError()); - assertThat( - message2.getMessage(), - is("cannot find symbol" + EOL + "symbol : class Properties" + EOL + "location: class Error")); + assertEquals( + "cannot find symbol" + EOL + "symbol : class Properties" + EOL + "location: class Error", + message2.getMessage()); - assertThat(message2.getStartColumn(), is(35)); + assertEquals(35, message2.getStartColumn()); - assertThat(message2.getEndColumn(), is(48)); + assertEquals(48, message2.getEndColumn()); - assertThat(message2.getStartLine(), is(3)); + assertEquals(3, message2.getStartLine()); - assertThat(message2.getEndLine(), is(3)); + assertEquals(3, message2.getEndLine()); } @Test @@ -745,39 +743,39 @@ public void testJava7Error() throws Exception { List compilerErrors = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(out))); - assertThat(compilerErrors, notNullValue()); + assertNotNull(compilerErrors); CompilerMessage message1 = compilerErrors.get(0); - assertThat(message1.isError(), is(true)); + assertTrue(message1.isError()); - assertThat( - message1.getMessage(), - is("cannot find symbol" + EOL + " symbol: class Properties" + EOL + " location: class Error")); + assertEquals( + "cannot find symbol" + EOL + " symbol: class Properties" + EOL + " location: class Error", + message1.getMessage()); - assertThat(message1.getStartColumn(), is(16)); + assertEquals(16, message1.getStartColumn()); - assertThat(message1.getEndColumn(), is(26)); + assertEquals(26, message1.getEndColumn()); - assertThat(message1.getStartLine(), is(3)); + assertEquals(3, message1.getStartLine()); - assertThat(message1.getEndLine(), is(3)); + assertEquals(3, message1.getEndLine()); CompilerMessage message2 = compilerErrors.get(1); - assertThat(message2.isError(), is(true)); + assertTrue(message2.isError()); - assertThat( - message2.getMessage(), - is("cannot find symbol" + EOL + " symbol: class Properties" + EOL + " location: class Error")); + assertEquals( + "cannot find symbol" + EOL + " symbol: class Properties" + EOL + " location: class Error", + message2.getMessage()); - assertThat(message2.getStartColumn(), is(35)); + assertEquals(35, message2.getStartColumn()); - assertThat(message2.getEndColumn(), is(48)); + assertEquals(48, message2.getEndColumn()); - assertThat(message2.getStartLine(), is(3)); + assertEquals(3, message2.getStartLine()); - assertThat(message2.getEndLine(), is(3)); + assertEquals(3, message2.getEndLine()); } @ParameterizedTest(name = "{0}") @@ -788,15 +786,15 @@ public void testStackTraceWithUnknownHeader(String scenario, String stackTraceHe List compilerMessages = JavacCompiler.parseModernStream(4, new BufferedReader(new StringReader(stackTraceWithHeader))); - assertThat(compilerMessages, notNullValue()); - assertThat(compilerMessages, hasSize(1)); + assertNotNull(compilerMessages); + assertEquals(1, compilerMessages.size()); String message = compilerMessages.get(0).getMessage().replaceAll(EOL, "\n"); // Parser retains neither unidentified log lines nor slightly modified stack trace header - assertThat(message, not(containsString(UNIDENTIFIED_LOG_LINES))); - assertThat(message, not(containsString(stackTraceHeader))); + assertTrue(!message.contains(UNIDENTIFIED_LOG_LINES)); + assertTrue(!message.contains(stackTraceHeader)); // Parser returns stack strace without any preceding lines - assertThat(message, startsWith(stackTraceInternalCompilerError)); + assertTrue(message.startsWith(stackTraceInternalCompilerError)); } private static Stream testStackTraceWithUnknownHeader_args() { @@ -823,13 +821,13 @@ public void testBugParade(String jdkAndLocale, String stackTraceHeader) throws E List compilerMessages = JavacCompiler.parseModernStream(4, new BufferedReader(new StringReader(stackTraceWithHeader))); - assertThat(compilerMessages, notNullValue()); - assertThat(compilerMessages, hasSize(1)); + assertNotNull(compilerMessages); + assertEquals(1, compilerMessages.size()); String message = compilerMessages.get(0).getMessage().replaceAll(EOL, "\n"); // Parser retains stack trace header - assertThat(message, startsWith(stackTraceHeader)); - assertThat(message, endsWith(stackTraceInternalCompilerError)); + assertTrue(message.startsWith(stackTraceHeader)); + assertTrue(message.endsWith(stackTraceInternalCompilerError)); } private static final String stackTraceInternalCompilerError = @@ -888,13 +886,13 @@ public void testSystemOutOfResourcesError(String jdkAndLocale, String stackTrace List compilerMessages = JavacCompiler.parseModernStream(4, new BufferedReader(new StringReader(stackTraceWithHeader))); - assertThat(compilerMessages, notNullValue()); - assertThat(compilerMessages, hasSize(1)); + assertNotNull(compilerMessages); + assertEquals(1, compilerMessages.size()); String message = compilerMessages.get(0).getMessage().replaceAll(EOL, "\n"); // Parser retains stack trace header - assertThat(message, startsWith(stackTraceHeader)); - assertThat(message, endsWith(stackTraceSystemOutOfResourcesError)); + assertTrue(message.startsWith(stackTraceHeader)); + assertTrue(message.endsWith(stackTraceSystemOutOfResourcesError)); } private static final String stackTraceSystemOutOfResourcesError = @@ -938,13 +936,13 @@ public void testIOError(String jdkAndLocale, String stackTraceHeader) throws Exc List compilerMessages = JavacCompiler.parseModernStream(4, new BufferedReader(new StringReader(stackTraceWithHeader))); - assertThat(compilerMessages, notNullValue()); - assertThat(compilerMessages, hasSize(1)); + assertNotNull(compilerMessages); + assertEquals(1, compilerMessages.size()); String message = compilerMessages.get(0).getMessage().replaceAll(EOL, "\n"); // Parser retains stack trace header - assertThat(message, startsWith(stackTraceHeader)); - assertThat(message, endsWith(stackTraceIOError)); + assertTrue(message.startsWith(stackTraceHeader)); + assertTrue(message.endsWith(stackTraceIOError)); } private static final String stackTraceIOError = @@ -985,13 +983,13 @@ public void testPluginError(String jdkAndLocale, String stackTraceHeader) throws List compilerMessages = JavacCompiler.parseModernStream(4, new BufferedReader(new StringReader(stackTraceWithHeader))); - assertThat(compilerMessages, notNullValue()); - assertThat(compilerMessages, hasSize(1)); + assertNotNull(compilerMessages); + assertEquals(1, compilerMessages.size()); String message = compilerMessages.get(0).getMessage().replaceAll(EOL, "\n"); // Parser retains stack trace header - assertThat(message, startsWith(stackTraceHeader)); - assertThat(message, endsWith(stackTracePluginError)); + assertTrue(message.startsWith(stackTraceHeader)); + assertTrue(message.endsWith(stackTracePluginError)); } private static final String stackTracePluginError = @@ -1025,8 +1023,8 @@ public void testNonAnchoredWarning() throws IOException { final List compilerErrors = JavacCompiler.parseModernStream(0, new BufferedReader(new StringReader(error))); - assertThat(compilerErrors, notNullValue()); - assertThat(compilerErrors.size(), is(1)); + assertNotNull(compilerErrors); + assertEquals(1, compilerErrors.size()); assertEquivalent( new CompilerMessage( "[options] bootstrap class path not set in conjunction with -source 1.6", @@ -1046,8 +1044,8 @@ public void testAnchoredWarning() throws IOException { final List compilerErrors = JavacCompiler.parseModernStream(0, new BufferedReader(new StringReader(error))); - assertThat(compilerErrors, notNullValue()); - assertThat(compilerErrors.size(), is(1)); + assertNotNull(compilerErrors); + assertEquals(1, compilerErrors.size()); assertEquivalent( new CompilerMessage( "C:\\repo\\src\\it\\includes-output-when-compiler-forked\\src\\main\\java\\MyClass" + ".java", @@ -1072,8 +1070,8 @@ public void testMixedWarnings() throws IOException { final List compilerErrors = JavacCompiler.parseModernStream(0, new BufferedReader(new StringReader(error))); - assertThat(compilerErrors, notNullValue()); - assertThat(compilerErrors.size(), is(2)); + assertNotNull(compilerErrors); + assertEquals(2, compilerErrors.size()); assertEquivalent( new CompilerMessage( "[options] bootstrap class path not set in conjunction with -source 1.6", @@ -1141,8 +1139,8 @@ public void testIssue37() throws IOException { List compilerErrors = JavacCompiler.parseModernStream(0, new BufferedReader(new StringReader(error))); - assertThat(compilerErrors, notNullValue()); - assertThat(compilerErrors.size(), is(4)); + assertNotNull(compilerErrors); + assertEquals(4, compilerErrors.size()); assertEquivalent( new CompilerMessage( @@ -1162,13 +1160,14 @@ public void testIssue37() throws IOException { compilerErrors.get(2)); CompilerMessage finalMessage = compilerErrors.get(3); - assertThat(finalMessage.getKind(), is(CompilerMessage.Kind.ERROR)); - assertThat( - "Starts correctly", finalMessage.getMessage(), startsWith("An exception has occurred in the compiler")); - assertThat( - "continues through end of output", - finalMessage.getMessage(), - endsWith("\tat jdk.compiler/com.sun" + ".tools.javac.Main.main(Main.java:43)" + EOL)); + assertEquals(CompilerMessage.Kind.ERROR, finalMessage.getKind()); + assertTrue( + finalMessage.getMessage().startsWith("An exception has occurred in the compiler"), "Starts correctly"); + assertTrue( + finalMessage + .getMessage() + .endsWith("\tat jdk.compiler/com.sun" + ".tools.javac.Main.main(Main.java:43)" + EOL), + "continues through end of output"); } @Test @@ -1179,10 +1178,10 @@ public void testJvmBootLayerInitializationError() throws Exception { List compilerErrors = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(UNIDENTIFIED_LOG_LINES + out))); - assertThat(compilerErrors, notNullValue()); - assertThat(compilerErrors.size(), is(1)); - assertThat(compilerErrors.get(0).getKind(), is(CompilerMessage.Kind.ERROR)); - assertThat(compilerErrors.get(0).getMessage().replaceAll(EOL, "\n"), startsWith(out)); + assertNotNull(compilerErrors); + assertEquals(1, compilerErrors.size()); + assertEquals(CompilerMessage.Kind.ERROR, compilerErrors.get(0).getKind()); + assertTrue(compilerErrors.get(0).getMessage().replaceAll(EOL, "\n").startsWith(out)); } @Test @@ -1193,10 +1192,10 @@ public void testJvmInitializationError() throws Exception { List compilerErrors = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(UNIDENTIFIED_LOG_LINES + out))); - assertThat(compilerErrors, notNullValue()); - assertThat(compilerErrors.size(), is(1)); - assertThat(compilerErrors.get(0).getKind(), is(CompilerMessage.Kind.ERROR)); - assertThat(compilerErrors.get(0).getMessage().replaceAll(EOL, "\n"), startsWith(out)); + assertNotNull(compilerErrors); + assertEquals(1, compilerErrors.size()); + assertEquals(CompilerMessage.Kind.ERROR, compilerErrors.get(0).getKind()); + assertTrue(compilerErrors.get(0).getMessage().replaceAll(EOL, "\n").startsWith(out)); } @Test @@ -1211,9 +1210,9 @@ public void testBadSourceFileError() throws Exception { List compilerErrors = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(out))); - assertThat(compilerErrors, notNullValue()); + assertNotNull(compilerErrors); - assertThat(compilerErrors.size(), is(1)); + assertEquals(1, compilerErrors.size()); CompilerMessage message = compilerErrors.get(0); validateBadSourceFile(message); @@ -1235,38 +1234,36 @@ public void testWarningFollowedByBadSourceFileError() throws Exception { List compilerErrors = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(out))); - assertThat(compilerErrors, notNullValue()); + assertNotNull(compilerErrors); - assertThat(compilerErrors, hasSize(2)); + assertEquals(2, compilerErrors.size()); CompilerMessage firstMessage = compilerErrors.get(0); - assertThat("Is a Warning", firstMessage.getKind(), is(CompilerMessage.Kind.WARNING)); - assertThat( - "On Correct File", - firstMessage.getFile(), - is("/MTOOLCHAINS-19/src/main/java/ch/pecunifex/x/Cls1.java")); - assertThat( - "Internal API Warning", + assertEquals(CompilerMessage.Kind.WARNING, firstMessage.getKind(), "Is a Warning"); + assertEquals( + "/MTOOLCHAINS-19/src/main/java/ch/pecunifex/x/Cls1.java", firstMessage.getFile(), "On Correct File"); + assertEquals( + "FontDesignMetrics is internal proprietary API and may be removed in a future release", firstMessage.getMessage(), - is("FontDesignMetrics is internal proprietary API and may be removed in a future release")); + "Internal API Warning"); CompilerMessage secondMessage = compilerErrors.get(1); validateBadSourceFile(secondMessage); } private void validateBadSourceFile(CompilerMessage message) { - assertThat("Is an Error", message.getKind(), is(CompilerMessage.Kind.ERROR)); - assertThat("On Correct File", message.getFile(), is("/MTOOLCHAINS-19/src/main/java/ch/pecunifex/x/Cls1.java")); - assertThat("Message starts with access Error", message.getMessage(), startsWith("cannot access Cls2")); + assertEquals(CompilerMessage.Kind.ERROR, message.getKind(), "Is an Error"); + assertEquals("/MTOOLCHAINS-19/src/main/java/ch/pecunifex/x/Cls1.java", message.getFile(), "On Correct File"); + assertTrue(message.getMessage().startsWith("cannot access Cls2"), "Message starts with access Error"); } private static void assertEquivalent(CompilerMessage expected, CompilerMessage actual) { - assertThat("Message did not match", actual.getMessage(), is(expected.getMessage())); - assertThat("Kind did not match", actual.getKind(), is(expected.getKind())); - assertThat("File did not match", actual.getFile(), is(expected.getFile())); - assertThat("Start line did not match", actual.getStartLine(), is(expected.getStartLine())); - assertThat("Start column did not match", actual.getStartColumn(), is(expected.getStartColumn())); - assertThat("End line did not match", actual.getEndLine(), is(expected.getEndLine())); - assertThat("End column did not match", actual.getEndColumn(), is(expected.getEndColumn())); + assertEquals(expected.getMessage(), actual.getMessage(), "Message did not match"); + assertEquals(expected.getKind(), actual.getKind(), "Kind did not match"); + assertEquals(expected.getFile(), actual.getFile(), "File did not match"); + assertEquals(expected.getStartLine(), actual.getStartLine(), "Start line did not match"); + assertEquals(expected.getStartColumn(), actual.getStartColumn(), "Start column did not match"); + assertEquals(expected.getEndLine(), actual.getEndLine(), "End line did not match"); + assertEquals(expected.getEndColumn(), actual.getEndColumn(), "End column did not match"); } } diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavacCompilerTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavacCompilerTest.java index 78393b6af..82a311cd9 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavacCompilerTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavacCompilerTest.java @@ -15,13 +15,9 @@ import org.junit.jupiter.params.provider.MethodSource; import static org.codehaus.plexus.compiler.javac.JavacCompiler.Messages.*; -import static org.hamcrest.CoreMatchers.endsWith; -import static org.hamcrest.CoreMatchers.startsWith; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.notNullValue; 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; /* @@ -66,13 +62,13 @@ void testParseModernStream_withAnnotationProcessingErrors(String jdkAndLocale, S List compilerMessages = JavacCompiler.parseModernStream(1, new BufferedReader(new StringReader(stackTraceWithHeader))); - assertThat(compilerMessages, notNullValue()); - assertThat(compilerMessages, hasSize(1)); + assertNotNull(compilerMessages); + assertEquals(1, compilerMessages.size()); String message = compilerMessages.get(0).getMessage().replaceAll(EOL, "\n"); // Parser retains stack trace header - assertThat(message, startsWith(stackTraceHeader)); - assertThat(message, endsWith(stackTraceAnnotationProcessingError)); + assertTrue(message.startsWith(stackTraceHeader)); + assertTrue(message.endsWith(stackTraceAnnotationProcessingError)); } private static final String stackTraceAnnotationProcessingError = diff --git a/pom.xml b/pom.xml index 8a830f8df..37f76e7d0 100644 --- a/pom.xml +++ b/pom.xml @@ -123,11 +123,6 @@ org.eclipse.sisu.inject ${eclipse.sisu.version} - - org.hamcrest - hamcrest - 3.0 - org.codehaus.plexus plexus-utils From a898d366b82132d7fb2c2078e2c540c21ab629cb Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sat, 4 Apr 2026 21:45:15 +0200 Subject: [PATCH 2/2] Fix start column assertion in ErrorMessageParserTest --- .../codehaus/plexus/compiler/javac/ErrorMessageParserTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java index 4ec3e24d4..8b159b1a2 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/ErrorMessageParserTest.java @@ -672,7 +672,7 @@ public void testCRLF_windows() throws Exception { error3.getMessage(), "message"); assertEquals(152, error3.getStartLine(), "line"); - assertEquals(12, error3.getStartColumn(), "column"); + assertEquals(16, error3.getStartColumn(), "column"); } @Test