Bukama commented on code in PR #192: URL: https://github.com/apache/maven-pmd-plugin/pull/192#discussion_r2051770246
########## src/test/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojoTest.java: ########## @@ -29,20 +32,16 @@ public class CpdViolationCheckMojoTest extends AbstractPmdReportTestCase { public void testDefaultConfiguration() throws Exception { generateReport("cpd", "default-configuration/cpd-default-configuration-plugin-config.xml"); - // clear the output from previous pmd:cpd execution - CapturingPrintStream.init(true); - try { File testPom = new File( getBasedir(), - "src/test/resources/unit/default-configuration/pmd-check-default-configuration-plugin-config.xml"); - final CpdViolationCheckMojo cpdViolationMojo = (CpdViolationCheckMojo) lookupMojo(getGoal(), testPom); - cpdViolationMojo.execute(); + "src/test/resources/unit/default-configuration/cpd-check-default-configuration-plugin-config.xml"); + final CpdViolationCheckMojo cpdViolationCheckMojo = (CpdViolationCheckMojo) lookupMojo(getGoal(), testPom); + cpdViolationCheckMojo.execute(); fail("MojoFailureException should be thrown."); - } catch (final Exception e) { - assertTrue(e.getMessage() - .startsWith("CPD " + AbstractPmdReport.getPmdVersion() + " has found 1 duplication.")); + } catch (final MojoFailureException e) { Review Comment: There are asserts for expections, see https://junit.org/junit5/docs/current/user-guide/#writing-tests-exceptions-expected -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org