Skip to content

Commit

Permalink
More tests moved to JUnit5
Browse files Browse the repository at this point in the history
  • Loading branch information
pibizza committed Nov 21, 2024
1 parent b5a22b9 commit a0945e1
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.drools.testcoverage.domain.Drink;
import org.drools.testcoverage.domain.Order;
import org.drools.testcoverage.kieci.withdomain.util.KJarLoadUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer;
Expand All @@ -45,13 +45,13 @@ public class KJarLoadingTest {

private KieSession kieSession;

@Before
@BeforeEach
public void init() {
final KieContainer container = KS.newKieContainer(KJAR_RELEASE_ID, this.getClass().getClassLoader());
this.kieSession = container.newKieSession();
}

@After
@AfterEach
public void dispose() {
if (this.kieSession != null) {
this.kieSession.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
package org.drools.testcoverage.kieci.withoutdomain;

import org.drools.testcoverage.kieci.withoutdomain.util.KJarLoadUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer;
Expand All @@ -42,13 +42,13 @@ public class KJarLoadingTest {

private KieSession kieSession;

@Before
@BeforeEach
public void init() {
final KieContainer container = KS.newKieContainer(KJAR_RELEASE_ID);
this.kieSession = container.newKieSession();
}

@After
@AfterEach
public void dispose() {
if (this.kieSession != null) {
this.kieSession.dispose();
Expand Down
5 changes: 5 additions & 0 deletions drools-test-coverage/test-integration-nomvel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@

import org.drools.core.ClockType;
import org.drools.core.time.impl.PseudoClockScheduler;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.model.KieModuleModel;
import org.kie.api.conf.EventProcessingOption;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.conf.ClockTypeOption;
import org.kie.api.runtime.rule.FactHandle;
import org.kie.api.time.Calendar;
import org.kie.api.time.SessionClock;

import static org.assertj.core.api.Assertions.assertThat;
import static org.drools.compiler.integrationtests.nomvel.TestUtil.getKieSession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.drools.compiler.integrationtests.nomvel;

import org.drools.testcoverage.common.model.Person;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.builder.Results;
import org.kie.api.runtime.KieContainer;

Expand Down
6 changes: 5 additions & 1 deletion drools-test-coverage/test-integration-notms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,33 @@
*/
package org.drools.compiler.integrationtests.notms;

import java.util.Collection;
import java.util.List;
import java.util.stream.Stream;

import org.drools.testcoverage.common.util.KieBaseTestConfiguration;
import org.drools.testcoverage.common.util.KieBaseUtil;
import org.drools.testcoverage.common.util.KieUtil;
import org.drools.testcoverage.common.util.TestParametersUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.drools.testcoverage.common.util.TestParametersUtil2;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.kie.api.KieBase;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.Message;
import org.kie.api.runtime.KieSession;

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

@RunWith(Parameterized.class)

public class NoTmsTest {
private final KieBaseTestConfiguration kieBaseTestConfiguration;

public NoTmsTest(final KieBaseTestConfiguration kieBaseTestConfiguration) {
this.kieBaseTestConfiguration = kieBaseTestConfiguration;
}

@Parameterized.Parameters(name = "KieBase type={0}")
public static Collection<Object[]> getParameters() {
return TestParametersUtil.getKieBaseCloudConfigurations(true);
public static Stream<KieBaseTestConfiguration> parameters() {
return TestParametersUtil2.getKieBaseCloudConfigurations(true).stream();
}

@Test
public void testUnsupportedTms() {
@ParameterizedTest(name = "KieBase type={0}")
@MethodSource("parameters")
public void testUnsupportedTms(KieBaseTestConfiguration kieBaseTestConfiguration) {
String drl =
"package org.drools.test; \n" +
"" +
Expand All @@ -70,8 +65,9 @@ public void testUnsupportedTms() {
assertThat(errors.get(0).getText().contains("drools-tms")).isTrue();
}

@Test
public void testPlainInsert() {
@ParameterizedTest(name = "KieBase type={0}")
@MethodSource("parameters")
public void testPlainInsert(KieBaseTestConfiguration kieBaseTestConfiguration) {
String drl =
"package org.drools.test; \n" +
"" +
Expand Down
10 changes: 5 additions & 5 deletions drools-test-coverage/test-integration-noxml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
<artifactId>drools-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

import org.drools.model.codegen.ExecutableModelProject;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.model.KieModuleModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.drools.compiler.integrationtests.noxml;

import org.drools.model.codegen.ExecutableModelProject;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.model.KieModuleModel;
Expand Down

0 comments on commit a0945e1

Please sign in to comment.