Skip to content

Commit

Permalink
Migrated impact analysis to junit5 (apache#6079)
Browse files Browse the repository at this point in the history
  • Loading branch information
pibizza authored Sep 11, 2024
1 parent e3124f5 commit 1838704
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@
<artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.drools.impact.analysis.graph.Node;
import org.drools.impact.analysis.graph.ReactivityType;
import org.drools.impact.analysis.model.Rule;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.linesOf;
Expand All @@ -43,7 +43,7 @@
*/
public class GraphvizOutputTest {

@After
@AfterEach
public void tearDown() {
Graphviz.releaseEngine();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.drools.impact.analysis.graph.Node;
import org.drools.impact.analysis.graph.ReactivityType;
import org.drools.impact.analysis.model.Rule;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
8 changes: 4 additions & 4 deletions drools-impact-analysis/drools-impact-analysis-itests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.internal.ImpactAnalysisKieModule;
import org.drools.impact.analysis.parser.internal.ImpactAnalysisProject;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
import org.drools.impact.analysis.graph.Node;
import org.drools.impact.analysis.graph.ReactivityType;
import org.drools.impact.analysis.graph.graphviz.GraphImageGenerator;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.junit.jupiter.api.TestInfo;
import org.kie.api.KieServices;
import org.kie.api.builder.KieFileSystem;
import org.kie.api.builder.ReleaseId;
Expand All @@ -48,32 +47,26 @@ public class AbstractGraphTest {

private static final Logger logger = LoggerFactory.getLogger(AbstractGraphTest.class);

@Rule
public TestName testName = new TestName();

protected String getTestMethodName() {
return testName.getMethodName();
}

// Keep this method for test convenience
protected void generatePng(Graph graph) {
generatePng(graph, "");
protected void generatePng(TestInfo testInfo, Graph graph) {
generatePng(testInfo, graph, "");
}

// Keep this method for test convenience
protected void generateSvg(Graph graph) {
generateSvg(graph, "");
protected void generateSvg(TestInfo testInfo, Graph graph) {
generateSvg(testInfo, graph, "");
}

// Keep this method for test convenience
protected void generatePng(Graph graph, String suffix) {
GraphImageGenerator generator = new GraphImageGenerator(getTestMethodName() + suffix);
protected void generatePng(TestInfo testInfo, Graph graph, String suffix) {
GraphImageGenerator generator = new GraphImageGenerator(testInfo.getDisplayName() + suffix);
generator.generatePng(graph);
}

// Keep this method for test convenience
protected void generateSvg(Graph graph, String suffix) {
GraphImageGenerator generator = new GraphImageGenerator(getTestMethodName() + suffix);
protected void generateSvg(TestInfo testInfo, Graph graph, String suffix) {
GraphImageGenerator generator = new GraphImageGenerator(testInfo.getDisplayName() + suffix);
generator.generateSvg(graph);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
import org.drools.impact.analysis.integrationtests.domain.Person;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;



public class BasicGraphTest extends AbstractGraphTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.drools.impact.analysis.model.right.DeleteSpecificFactAction;
import org.drools.impact.analysis.model.right.SpecificProperty;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* This test is to verify that DeleteSpecificFactAction can be handled correctly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.drools.impact.analysis.integrationtests.domain.Person;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.drools.impact.analysis.parser.ModelBuilder;
import org.drools.impact.analysis.parser.internal.ImpactAnalysisKieModule;
import org.drools.impact.analysis.parser.internal.ImpactAnalysisProject;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.drools.impact.analysis.integrationtests.domain.Order;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.drools.impact.analysis.graph.TextReporter.INDENT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.drools.impact.analysis.integrationtests.domain.Person;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.drools.impact.analysis.integrationtests.domain.Person;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.drools.impact.analysis.integrationtests.domain.Person;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.drools.impact.analysis.integrationtests.domain.ProductItem;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
import java.math.BigInteger;

import org.drools.util.StringUtils;
import org.junit.jupiter.api.Test;
import org.drools.impact.analysis.graph.Graph;
import org.drools.impact.analysis.graph.ModelToGraphConverter;
import org.drools.impact.analysis.graph.ReactivityType;
import org.drools.impact.analysis.integrationtests.domain.PropHolder;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;

public class TypeTest extends AbstractGraphTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.drools.impact.analysis.integrationtests.kogito.domain.LoanApplication;
import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.ModelBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
*
Expand Down
4 changes: 2 additions & 2 deletions drools-impact-analysis/drools-impact-analysis-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.drools.impact.analysis.model.AnalysisModel;
import org.drools.impact.analysis.parser.domain.Person;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class ParserTest {

Expand Down

0 comments on commit 1838704

Please sign in to comment.