Skip to content

Commit

Permalink
Upgrade to JUnit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
slachiewicz committed Oct 3, 2024
1 parent e633009 commit b548a2c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
<version>${jdependVersion}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
11 changes: 6 additions & 5 deletions src/test/java/org/codehaus/mojo/jdepend/JDependMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
import java.io.IOException;

import jdepend.xmlui.JDepend;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.xmlunit.builder.DiffBuilder;
import org.xmlunit.builder.Input;
import org.xmlunit.diff.Diff;

import static org.junit.jupiter.api.Assertions.assertFalse;

public class JDependMojoTest {
JDependXMLReportParser parser;

Expand All @@ -40,7 +41,7 @@ public class JDependMojoTest {

private final File reportXML = new File(basedir, REPORT_PATH);

@Before
@BeforeEach
public void setUp() throws Exception {
parser = new JDependXMLReportParser(reportXML);
}
Expand All @@ -63,6 +64,6 @@ public void testJDependReportContent() throws IOException {
.ignoreComments()
.build();

Assert.assertFalse(myDiff.toString(), myDiff.hasDifferences());
assertFalse(myDiff.hasDifferences(), myDiff.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

import org.codehaus.mojo.jdepend.objects.JDPackage;
import org.codehaus.mojo.jdepend.objects.Stats;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class JDependReportParserTest {
private JDependXMLReportParser parser;
Expand All @@ -40,7 +40,7 @@ public class JDependReportParserTest {

private final String basedir = System.getProperty("basedir");

@Before
@BeforeEach
public void setUp() throws Exception {
File reportXML = new File(basedir, JDependMojoTest.REPORT_PATH);
parser = new JDependXMLReportParser(reportXML);
Expand All @@ -50,7 +50,7 @@ public void setUp() throws Exception {

@Test
public void testTotalNumberPackages() {
assertEquals("Total number of packages is not equal to expected output", 3, parser.packages.size());
assertEquals(3, parser.packages.size(), "Total number of packages is not equal to expected output");
}

@Test
Expand Down Expand Up @@ -81,9 +81,9 @@ public void testStats() {
if (jdpackage.getPackageName().equals("org.codehaus.mojo.jdepend")) {
Stats stats = jdpackage.getStats();

assertEquals("Stats Total Classes is not equal to expected output", "5", stats.getTotalClasses());
assertEquals("Stats Concrete classes is not equal to expected output", "4", stats.getConcreteClasses());
assertEquals("Stats Abstract Classes is not equal to expected output", "1", stats.getAbstractClasses());
assertEquals("5", stats.getTotalClasses(), "Stats Total Classes is not equal to expected output");
assertEquals("4", stats.getConcreteClasses(), "Stats Concrete classes is not equal to expected output");
assertEquals("1", stats.getAbstractClasses(), "Stats Abstract Classes is not equal to expected output");
assertEquals("0", stats.getCa());
assertEquals("14", stats.getCe());
assertEquals("0.2", stats.getA());
Expand All @@ -94,9 +94,9 @@ public void testStats() {
if (jdpackage.getPackageName().equals("org.codehaus.mojo.jdepend.objects")) {
Stats stats = jdpackage.getStats();

assertEquals("Stats Total Classes is not equal to expected output", "4", stats.getTotalClasses());
assertEquals("Stats Concrete classes is not equal to expected output", "4", stats.getConcreteClasses());
assertEquals("Stats Abstract Classes is not equal to expected output", "0", stats.getAbstractClasses());
assertEquals("4", stats.getTotalClasses(), "Stats Total Classes is not equal to expected output");
assertEquals("4", stats.getConcreteClasses(), "Stats Concrete classes is not equal to expected output");
assertEquals("0", stats.getAbstractClasses(), "Stats Abstract Classes is not equal to expected output");
assertEquals("1", stats.getCa());
assertEquals("2", stats.getCe());
assertEquals("0", stats.getA());
Expand Down

0 comments on commit b548a2c

Please sign in to comment.