diff --git a/drools-compiler/pom.xml b/drools-compiler/pom.xml index 557640fdfbb..cfa70e99f13 100644 --- a/drools-compiler/pom.xml +++ b/drools-compiler/pom.xml @@ -144,6 +144,11 @@ drools-wiring-dynamic test + + org.junit.jupiter + junit-jupiter + test + org.kie diff --git a/drools-compiler/src/test/java/org/drools/compiler/CompilerTest.java b/drools-compiler/src/test/java/org/drools/compiler/CompilerTest.java index f637cbe3b53..1650e04e3a7 100644 --- a/drools-compiler/src/test/java/org/drools/compiler/CompilerTest.java +++ b/drools-compiler/src/test/java/org/drools/compiler/CompilerTest.java @@ -18,7 +18,7 @@ */ package org.drools.compiler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.io.ResourceType; import org.kie.internal.utils.KieHelper; diff --git a/drools-compiler/src/test/java/org/drools/compiler/lang/descr/CompositePackageDescrTest.java b/drools-compiler/src/test/java/org/drools/compiler/lang/descr/CompositePackageDescrTest.java index c39dc3789a7..8db4b817aca 100644 --- a/drools-compiler/src/test/java/org/drools/compiler/lang/descr/CompositePackageDescrTest.java +++ b/drools-compiler/src/test/java/org/drools/compiler/lang/descr/CompositePackageDescrTest.java @@ -20,10 +20,11 @@ import org.drools.drl.ast.descr.PackageDescr; import org.drools.io.ByteArrayResource; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.drools.util.StringUtils.generateUUID; public class CompositePackageDescrTest { @@ -31,7 +32,7 @@ public class CompositePackageDescrTest { private static final String NAMESPACE = "namespace"; private CompositePackageDescr compositePackageDescr; - @Before + @BeforeEach public void setup() { compositePackageDescr = new CompositePackageDescr(new ByteArrayResource(), new PackageDescr(NAMESPACE)); } @@ -50,7 +51,7 @@ public void addPackageDescrSamePkgUUID() { assertThat(compositePackageDescr.getPreferredPkgUUID().get()).isEqualTo(pkgUUID); } - @Test(expected = RuntimeException.class) + @Test public void addPackageDescrDifferentPkgUUID() { String pkgUUID = generateUUID(); PackageDescr first = new PackageDescr(NAMESPACE); @@ -64,6 +65,8 @@ public void addPackageDescrDifferentPkgUUID() { second.setPreferredPkgUUID(pkgUUID); assertThat(second.getPreferredPkgUUID().isPresent()).isTrue(); assertThat(second.getPreferredPkgUUID().get()).isNotEqualTo(first.getPreferredPkgUUID().get()); - compositePackageDescr.addPackageDescr(new ByteArrayResource(), second); + assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> { + compositePackageDescr.addPackageDescr(new ByteArrayResource(), second); + }); } } \ No newline at end of file diff --git a/drools-compiler/src/test/java/org/drools/compiler/lang/descr/PackageDescrTest.java b/drools-compiler/src/test/java/org/drools/compiler/lang/descr/PackageDescrTest.java index b5e7cee1202..c79c2c556c8 100644 --- a/drools-compiler/src/test/java/org/drools/compiler/lang/descr/PackageDescrTest.java +++ b/drools-compiler/src/test/java/org/drools/compiler/lang/descr/PackageDescrTest.java @@ -27,7 +27,7 @@ import org.drools.drl.ast.descr.PackageDescr; import org.drools.drl.ast.dsl.PackageDescrBuilder; import org.drools.drl.ast.dsl.impl.PackageDescrBuilderImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-examples-api/default-kiesession-from-file/pom.xml b/drools-examples-api/default-kiesession-from-file/pom.xml index c9155eafa17..1d2625481b1 100644 --- a/drools-examples-api/default-kiesession-from-file/pom.xml +++ b/drools-examples-api/default-kiesession-from-file/pom.xml @@ -41,12 +41,11 @@ org.drools drools-engine-classic - - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/default-kiesession-from-file/src/test/java/org/drools/example/api/defaultkiesessionfromfile/DefaultKieSessionFromByteArrayExampleTest.java b/drools-examples-api/default-kiesession-from-file/src/test/java/org/drools/example/api/defaultkiesessionfromfile/DefaultKieSessionFromByteArrayExampleTest.java index 76093b9989c..5735e26adbb 100644 --- a/drools-examples-api/default-kiesession-from-file/src/test/java/org/drools/example/api/defaultkiesessionfromfile/DefaultKieSessionFromByteArrayExampleTest.java +++ b/drools-examples-api/default-kiesession-from-file/src/test/java/org/drools/example/api/defaultkiesessionfromfile/DefaultKieSessionFromByteArrayExampleTest.java @@ -26,14 +26,14 @@ import java.io.PrintStream; import java.util.Arrays; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.KieServices; import org.kie.api.builder.KieModule; import org.kie.api.builder.KieRepository; import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieSession; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class DefaultKieSessionFromByteArrayExampleTest { diff --git a/drools-examples-api/default-kiesession-from-file/src/test/java/org/drools/example/api/defaultkiesessionfromfile/DefaultKieSessionFromFileExampleTest.java b/drools-examples-api/default-kiesession-from-file/src/test/java/org/drools/example/api/defaultkiesessionfromfile/DefaultKieSessionFromFileExampleTest.java index 4c5256c239e..b3ab286bad3 100644 --- a/drools-examples-api/default-kiesession-from-file/src/test/java/org/drools/example/api/defaultkiesessionfromfile/DefaultKieSessionFromFileExampleTest.java +++ b/drools-examples-api/default-kiesession-from-file/src/test/java/org/drools/example/api/defaultkiesessionfromfile/DefaultKieSessionFromFileExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.defaultkiesessionfromfile; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class DefaultKieSessionFromFileExampleTest { diff --git a/drools-examples-api/default-kiesession/pom.xml b/drools-examples-api/default-kiesession/pom.xml index ba5b8452f3c..9b40e312282 100644 --- a/drools-examples-api/default-kiesession/pom.xml +++ b/drools-examples-api/default-kiesession/pom.xml @@ -41,12 +41,11 @@ org.drools drools-engine-classic - - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/default-kiesession/src/test/java/org/drools/example/api/defaultkiesession/DefaultKieSessionExampleTest.java b/drools-examples-api/default-kiesession/src/test/java/org/drools/example/api/defaultkiesession/DefaultKieSessionExampleTest.java index c319068dab2..1767b87961b 100644 --- a/drools-examples-api/default-kiesession/src/test/java/org/drools/example/api/defaultkiesession/DefaultKieSessionExampleTest.java +++ b/drools-examples-api/default-kiesession/src/test/java/org/drools/example/api/defaultkiesession/DefaultKieSessionExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.defaultkiesession; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class DefaultKieSessionExampleTest { diff --git a/drools-examples-api/default-kiesession/src/test/java/org/drools/example/api/defaultkiesession/DefaultKieSessionFromFSExampleTest.java b/drools-examples-api/default-kiesession/src/test/java/org/drools/example/api/defaultkiesession/DefaultKieSessionFromFSExampleTest.java index 985c3eaaa80..edaf89ea336 100644 --- a/drools-examples-api/default-kiesession/src/test/java/org/drools/example/api/defaultkiesession/DefaultKieSessionFromFSExampleTest.java +++ b/drools-examples-api/default-kiesession/src/test/java/org/drools/example/api/defaultkiesession/DefaultKieSessionFromFSExampleTest.java @@ -18,18 +18,18 @@ */ package org.drools.example.api.defaultkiesession; -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.runtime.KieSession; import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.File; import java.io.IOException; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; - public class DefaultKieSessionFromFSExampleTest { private static final String NL = System.getProperty("line.separator"); diff --git a/drools-examples-api/kie-module-from-multiple-files/pom.xml b/drools-examples-api/kie-module-from-multiple-files/pom.xml index 7cc5e54f7c6..ea3cf74a873 100644 --- a/drools-examples-api/kie-module-from-multiple-files/pom.xml +++ b/drools-examples-api/kie-module-from-multiple-files/pom.xml @@ -42,18 +42,17 @@ drools-engine-classic - - junit - junit - test - - org.drools kiebase-inclusion runtime + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/kie-module-from-multiple-files/src/test/java/org/drools/example/api/kiemodulefrommultiplefiles/KieModuleFromMultipleFilesExampleTest.java b/drools-examples-api/kie-module-from-multiple-files/src/test/java/org/drools/example/api/kiemodulefrommultiplefiles/KieModuleFromMultipleFilesExampleTest.java index 403cd9392fb..8245690dd23 100644 --- a/drools-examples-api/kie-module-from-multiple-files/src/test/java/org/drools/example/api/kiemodulefrommultiplefiles/KieModuleFromMultipleFilesExampleTest.java +++ b/drools-examples-api/kie-module-from-multiple-files/src/test/java/org/drools/example/api/kiemodulefrommultiplefiles/KieModuleFromMultipleFilesExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.kiemodulefrommultiplefiles; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class KieModuleFromMultipleFilesExampleTest { diff --git a/drools-examples-api/kiebase-inclusion/pom.xml b/drools-examples-api/kiebase-inclusion/pom.xml index 05ae135c261..25a20d14ea0 100644 --- a/drools-examples-api/kiebase-inclusion/pom.xml +++ b/drools-examples-api/kiebase-inclusion/pom.xml @@ -45,11 +45,11 @@ org.drools named-kiesession - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/kiebase-inclusion/src/test/java/org/drools/example/api/kiebaseinclusion/KieBaseInclusionExampleTest.java b/drools-examples-api/kiebase-inclusion/src/test/java/org/drools/example/api/kiebaseinclusion/KieBaseInclusionExampleTest.java index 77804c46fb1..9c779cedc03 100644 --- a/drools-examples-api/kiebase-inclusion/src/test/java/org/drools/example/api/kiebaseinclusion/KieBaseInclusionExampleTest.java +++ b/drools-examples-api/kiebase-inclusion/src/test/java/org/drools/example/api/kiebaseinclusion/KieBaseInclusionExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.kiebaseinclusion; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class KieBaseInclusionExampleTest { diff --git a/drools-examples-api/kiecontainer-from-kierepo/pom.xml b/drools-examples-api/kiecontainer-from-kierepo/pom.xml index d55279a5cc4..b0156e4958c 100644 --- a/drools-examples-api/kiecontainer-from-kierepo/pom.xml +++ b/drools-examples-api/kiecontainer-from-kierepo/pom.xml @@ -41,6 +41,11 @@ org.kie kie-ci + + org.junit.jupiter + junit-jupiter + test + org.drools drools-engine-classic @@ -49,12 +54,6 @@ org.drools named-kiesession - - - junit - junit - test - diff --git a/drools-examples-api/kiecontainer-from-kierepo/src/test/java/org/drools/example/api/kiecontainerfromkierepo/KieContainerFromKieRepoExampleTest.java b/drools-examples-api/kiecontainer-from-kierepo/src/test/java/org/drools/example/api/kiecontainerfromkierepo/KieContainerFromKieRepoExampleTest.java index 70da1110b7b..3e24f8b0844 100644 --- a/drools-examples-api/kiecontainer-from-kierepo/src/test/java/org/drools/example/api/kiecontainerfromkierepo/KieContainerFromKieRepoExampleTest.java +++ b/drools-examples-api/kiecontainer-from-kierepo/src/test/java/org/drools/example/api/kiecontainerfromkierepo/KieContainerFromKieRepoExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.kiecontainerfromkierepo; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class KieContainerFromKieRepoExampleTest { diff --git a/drools-examples-api/kiefilesystem-example/pom.xml b/drools-examples-api/kiefilesystem-example/pom.xml index d3537b51834..382e65cb7fe 100644 --- a/drools-examples-api/kiefilesystem-example/pom.xml +++ b/drools-examples-api/kiefilesystem-example/pom.xml @@ -49,11 +49,11 @@ org.kie kie-api - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/kiefilesystem-example/src/test/java/org/drools/example/api/kiefilesystem/KieFileSystemExampleTest.java b/drools-examples-api/kiefilesystem-example/src/test/java/org/drools/example/api/kiefilesystem/KieFileSystemExampleTest.java index bc55c5dc4b1..ca973ed355e 100644 --- a/drools-examples-api/kiefilesystem-example/src/test/java/org/drools/example/api/kiefilesystem/KieFileSystemExampleTest.java +++ b/drools-examples-api/kiefilesystem-example/src/test/java/org/drools/example/api/kiefilesystem/KieFileSystemExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.kiefilesystem; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class KieFileSystemExampleTest { diff --git a/drools-examples-api/kiemodulemodel-example/pom.xml b/drools-examples-api/kiemodulemodel-example/pom.xml index fc6b6c3eb4f..6fb2269d926 100644 --- a/drools-examples-api/kiemodulemodel-example/pom.xml +++ b/drools-examples-api/kiemodulemodel-example/pom.xml @@ -54,18 +54,17 @@ kie-api - - junit - junit - test - - org.drools named-kiesession runtime + + org.junit.jupiter + junit-jupiter + test + org.drools kiebase-inclusion diff --git a/drools-examples-api/kiemodulemodel-example/src/test/java/org/drools/example/api/kiemodulemodel/KieModuleModelExampleTest.java b/drools-examples-api/kiemodulemodel-example/src/test/java/org/drools/example/api/kiemodulemodel/KieModuleModelExampleTest.java index 979a2baa9b4..7974d2f6ee0 100644 --- a/drools-examples-api/kiemodulemodel-example/src/test/java/org/drools/example/api/kiemodulemodel/KieModuleModelExampleTest.java +++ b/drools-examples-api/kiemodulemodel-example/src/test/java/org/drools/example/api/kiemodulemodel/KieModuleModelExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.kiemodulemodel; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class KieModuleModelExampleTest { diff --git a/drools-examples-api/multiple-kbases/pom.xml b/drools-examples-api/multiple-kbases/pom.xml index ad3aa3926c7..f5a8217c42f 100644 --- a/drools-examples-api/multiple-kbases/pom.xml +++ b/drools-examples-api/multiple-kbases/pom.xml @@ -41,11 +41,11 @@ org.drools drools-engine-classic - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/multiple-kbases/src/test/java/org/drools/example/api/multiplekbases/MultipleKbasesExampleTest.java b/drools-examples-api/multiple-kbases/src/test/java/org/drools/example/api/multiplekbases/MultipleKbasesExampleTest.java index a7faa33f89c..8eb9b808743 100644 --- a/drools-examples-api/multiple-kbases/src/test/java/org/drools/example/api/multiplekbases/MultipleKbasesExampleTest.java +++ b/drools-examples-api/multiple-kbases/src/test/java/org/drools/example/api/multiplekbases/MultipleKbasesExampleTest.java @@ -23,8 +23,8 @@ import org.drools.core.time.impl.JDKTimerService; import org.drools.core.time.impl.PseudoClockScheduler; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.kie.api.KieServices; import org.kie.api.builder.model.KieSessionModel; import org.kie.api.runtime.KieContainer; @@ -33,8 +33,8 @@ import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MultipleKbasesExampleTest { @@ -110,15 +110,15 @@ public void testEditSessionModel() { ClockTypeOption clockType = kieSessionModel.getClockType(); // clockType realtime - Assert.assertNotEquals(clockType, pseudoClock); + Assertions.assertNotEquals(clockType, pseudoClock); // change model to pseudo kieSessionModel.setClockType(pseudoClock); - Assert.assertEquals(kieSessionModel.getClockType(), pseudoClock); + Assertions.assertEquals(kieSessionModel.getClockType(), pseudoClock); // new pseudo session KieSession kSession = kContainer.newKieSession(name); - Assert.assertEquals(kSession.getSessionClock().getClass(), PseudoClockScheduler.class); + Assertions.assertEquals(kSession.getSessionClock().getClass(), PseudoClockScheduler.class); } @Test @@ -132,18 +132,18 @@ public void testEditSessionModelAfterFirstCreatedKieSession() { ClockTypeOption clockType = kieSessionModel.getClockType(); // clockType realtime - Assert.assertEquals(clockType, ClockTypeOption.REALTIME); - Assert.assertNotEquals(clockType, pseudoClock); + Assertions.assertEquals(clockType, ClockTypeOption.REALTIME); + Assertions.assertNotEquals(clockType, pseudoClock); // session is realtime KieSession kSession = kContainer.newKieSession(name); - Assert.assertEquals(kSession.getSessionClock().getClass(), JDKTimerService.class); + Assertions.assertEquals(kSession.getSessionClock().getClass(), JDKTimerService.class); // change model to pseudo kieSessionModel.setClockType(pseudoClock); // new session still realtime KieSession kSessionPseudo = kContainer.newKieSession(name); - Assert.assertEquals(kSessionPseudo.getSessionClock().getClass(), PseudoClockScheduler.class); + Assertions.assertEquals(kSessionPseudo.getSessionClock().getClass(), PseudoClockScheduler.class); } } \ No newline at end of file diff --git a/drools-examples-api/named-kiesession-from-file/pom.xml b/drools-examples-api/named-kiesession-from-file/pom.xml index ab0c04a8e78..68f963fa155 100644 --- a/drools-examples-api/named-kiesession-from-file/pom.xml +++ b/drools-examples-api/named-kiesession-from-file/pom.xml @@ -42,18 +42,17 @@ drools-engine-classic - - junit - junit - test - - org.drools named-kiesession runtime + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/named-kiesession-from-file/src/test/java/org/drools/example/api/namedkiesessionfromfile/NamedKieSessionFromFileExampleTest.java b/drools-examples-api/named-kiesession-from-file/src/test/java/org/drools/example/api/namedkiesessionfromfile/NamedKieSessionFromFileExampleTest.java index e2cd2afe1de..db5dec84573 100644 --- a/drools-examples-api/named-kiesession-from-file/src/test/java/org/drools/example/api/namedkiesessionfromfile/NamedKieSessionFromFileExampleTest.java +++ b/drools-examples-api/named-kiesession-from-file/src/test/java/org/drools/example/api/namedkiesessionfromfile/NamedKieSessionFromFileExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.namedkiesessionfromfile; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class NamedKieSessionFromFileExampleTest { private static final String NL = System.getProperty("line.separator"); diff --git a/drools-examples-api/named-kiesession/pom.xml b/drools-examples-api/named-kiesession/pom.xml index ff558c4a6e1..84860d54ad3 100644 --- a/drools-examples-api/named-kiesession/pom.xml +++ b/drools-examples-api/named-kiesession/pom.xml @@ -41,11 +41,11 @@ org.drools drools-engine-classic - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/named-kiesession/src/test/java/org/drools/example/api/namedkiesession/NamedKieSessionExampleTest.java b/drools-examples-api/named-kiesession/src/test/java/org/drools/example/api/namedkiesession/NamedKieSessionExampleTest.java index 4c22b893351..b5ec7fdda21 100644 --- a/drools-examples-api/named-kiesession/src/test/java/org/drools/example/api/namedkiesession/NamedKieSessionExampleTest.java +++ b/drools-examples-api/named-kiesession/src/test/java/org/drools/example/api/namedkiesession/NamedKieSessionExampleTest.java @@ -18,12 +18,12 @@ */ package org.drools.example.api.namedkiesession; -import org.junit.Test; - import java.io.ByteArrayOutputStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.PrintStream; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Test; public class NamedKieSessionExampleTest { private static final String NL = System.getProperty("line.separator"); diff --git a/drools-examples-api/pom.xml b/drools-examples-api/pom.xml index 68742076319..c7b3cef3796 100644 --- a/drools-examples-api/pom.xml +++ b/drools-examples-api/pom.xml @@ -59,6 +59,4 @@ multiple-kbases reactive-kiesession - - diff --git a/drools-examples-api/reactive-kiesession/pom.xml b/drools-examples-api/reactive-kiesession/pom.xml index b532d6ae6d4..eaa8cae2215 100644 --- a/drools-examples-api/reactive-kiesession/pom.xml +++ b/drools-examples-api/reactive-kiesession/pom.xml @@ -41,11 +41,11 @@ org.drools drools-engine-classic - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-examples-api/reactive-kiesession/src/test/java/org/drools/example/api/reactivekiesession/ReactiveKieSessionExampleTest.java b/drools-examples-api/reactive-kiesession/src/test/java/org/drools/example/api/reactivekiesession/ReactiveKieSessionExampleTest.java index 75044ac5f26..0b362777283 100644 --- a/drools-examples-api/reactive-kiesession/src/test/java/org/drools/example/api/reactivekiesession/ReactiveKieSessionExampleTest.java +++ b/drools-examples-api/reactive-kiesession/src/test/java/org/drools/example/api/reactivekiesession/ReactiveKieSessionExampleTest.java @@ -18,7 +18,7 @@ */ package org.drools.example.api.reactivekiesession; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.KieServices; import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieSession; @@ -26,8 +26,8 @@ import java.util.ArrayList; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class ReactiveKieSessionExampleTest { diff --git a/drools-fastutil/pom.xml b/drools-fastutil/pom.xml index 5e453e09b5d..eab48e87ee3 100644 --- a/drools-fastutil/pom.xml +++ b/drools-fastutil/pom.xml @@ -49,16 +49,15 @@ org.drools drools-core - - - junit - junit - test - org.assertj assertj-core test + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-fastutil/src/test/java/org/drools/fastutil/FastUtilTreeMemoryTest.java b/drools-fastutil/src/test/java/org/drools/fastutil/FastUtilTreeMemoryTest.java index bd42b7a9e69..000131b9da7 100644 --- a/drools-fastutil/src/test/java/org/drools/fastutil/FastUtilTreeMemoryTest.java +++ b/drools-fastutil/src/test/java/org/drools/fastutil/FastUtilTreeMemoryTest.java @@ -33,8 +33,8 @@ import org.drools.core.util.FastIterator; import org.drools.base.util.IndexedValueReader; import org.drools.fastutil.FastUtilTreeMemory.TreeFastIterator; +import org.junit.jupiter.api.Test; import org.drools.base.util.index.ConstraintTypeOperator; -import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-kiesession/pom.xml b/drools-kiesession/pom.xml index 31c361a1500..e9c29a0961f 100644 --- a/drools-kiesession/pom.xml +++ b/drools-kiesession/pom.xml @@ -87,12 +87,11 @@ drools-wiring-dynamic test - - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + org.assertj assertj-core @@ -104,5 +103,4 @@ test - diff --git a/drools-kiesession/src/test/java/org/drools/core/positional/BetaConstraintsPositionalIndexingTest.java b/drools-kiesession/src/test/java/org/drools/core/positional/BetaConstraintsPositionalIndexingTest.java index 3ae6dd13cfa..71116f22db3 100644 --- a/drools-kiesession/src/test/java/org/drools/core/positional/BetaConstraintsPositionalIndexingTest.java +++ b/drools-kiesession/src/test/java/org/drools/core/positional/BetaConstraintsPositionalIndexingTest.java @@ -43,7 +43,7 @@ import org.drools.core.test.model.Person; import org.drools.core.util.index.IndexSpec; import org.drools.kiesession.rulebase.SessionsAwareKnowledgeBase; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.runtime.KieSession; import org.kie.internal.conf.CompositeBaseConfiguration; import static org.assertj.core.api.Assertions.assertThat; @@ -105,9 +105,8 @@ public void testSingleInputEqualityIndexExpressions() { }; List results = new ArrayList<>(); - VoidFunction1> f2 = (c) -> { + VoidFunction1> f2 = (c) -> c.setFunction((VoidFunction2) (s, p) -> {results.add(new Object[] {s, p}); System.out.println(p.getName() + " lives in " + s);}); - }; testBody(null, f1, f2, false); @@ -129,9 +128,8 @@ public void testDoubleInputEqualityIndexExpressions() { }; List results = new ArrayList<>(); - VoidFunction1> f2 = (c) -> { + VoidFunction1> f2 = (c) -> c.setFunction((VoidFunction3) (s, i, p) -> {results.add(new Object[] {s, i, p}); System.out.println(p.getName() + " lives in " + s);}); - }; Person p1 = new Person("yoda", 300); p1.setCity("London"); @@ -173,9 +171,8 @@ public void testSingleInputRangeIndexExpressions() { }; List results = new ArrayList<>(); - VoidFunction1> f2 = (c) -> { + VoidFunction1> f2 = (c) -> c.setFunction((VoidFunction2) (s, p) -> {results.add(new Object[] {s, p}); System.out.println(p.getName() + " is younger than " + s);}); - }; testBody(f0, f1, f2, false); @@ -210,9 +207,8 @@ public void testDoubleInputRangeIndexExpressions() { }; List results = new ArrayList<>(); - VoidFunction1> f2 = (c) -> { + VoidFunction1> f2 = (c) -> c.setFunction((VoidFunction3) (s, i, p) -> {results.add(new Object[] {s, i, p}); System.out.println(p.getName() + " is younger than " + s);}); - }; testBody(f0, f1, f2, true); diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/AddRemoveTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/AddRemoveTest.java index c07a6b9a9a4..0a131a2ab86 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/AddRemoveTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/AddRemoveTest.java @@ -29,7 +29,7 @@ import org.drools.core.reteoo.builder.NodeFactory; import org.drools.core.reteoo.builder.PhreakNodeFactory; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class AddRemoveTest { @Test diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/CrossProductTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/CrossProductTest.java index e36af3b1881..042a4c9d201 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/CrossProductTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/CrossProductTest.java @@ -36,8 +36,8 @@ import org.drools.base.base.ObjectType; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.kie.api.runtime.KieSession; import static org.assertj.core.api.Assertions.assertThat; @@ -47,7 +47,7 @@ public class CrossProductTest { private KieSession ksession; private List values; - @Before + @BeforeEach public void setUp() throws Exception { final ObjectType list1ObjectType = new ClassObjectType( String.class ); final ObjectType list2ObjectType = new ClassObjectType( String.class ); diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/InternalRuleBaseConfigurationTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/InternalRuleBaseConfigurationTest.java index b984e51f806..2d111a94581 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/InternalRuleBaseConfigurationTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/InternalRuleBaseConfigurationTest.java @@ -25,7 +25,7 @@ import org.drools.core.RuleBaseConfiguration.SequentialAgenda; import org.drools.core.common.PriorityQueueAgendaGroupFactory; import org.drools.core.reteoo.RuntimeComponentFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.internal.conf.CompositeConfiguration; import org.kie.internal.utils.ChainedProperties; diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/NodeSegmentUnlinkingTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/NodeSegmentUnlinkingTest.java index 9693d65b11c..b7bfef34041 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/NodeSegmentUnlinkingTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/NodeSegmentUnlinkingTest.java @@ -52,7 +52,7 @@ import org.drools.core.common.PropagationContext; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/PropertyChangeListenerTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/PropertyChangeListenerTest.java index 8038fb61f05..9d62fd52b89 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/PropertyChangeListenerTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/PropertyChangeListenerTest.java @@ -29,8 +29,8 @@ import org.drools.core.reteoo.builder.BuildContext; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -39,7 +39,7 @@ public class PropertyChangeListenerTest { private BuildContext buildContext; private EntryPointNode entryPoint; - @Before + @BeforeEach public void setUp() throws Exception { this.kBase = KnowledgeBaseFactory.newKnowledgeBase(); this.buildContext = new BuildContext( kBase, Collections.emptyList() ); diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/QueryElementNodeTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/QueryElementNodeTest.java index 52cff7781e6..a75b98ee050 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/QueryElementNodeTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/QueryElementNodeTest.java @@ -32,8 +32,8 @@ import org.drools.core.common.PropagationContext; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +43,7 @@ public class QueryElementNodeTest { private InternalKnowledgeBase kBase; private BuildContext buildContext; - @Before + @BeforeEach public void setUp() { this.kBase = KnowledgeBaseFactory.newKnowledgeBase(); this.buildContext = new BuildContext( kBase, Collections.emptyList() ); diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/ReteTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/ReteTest.java index f9e927484dd..30a4c2abe07 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/ReteTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/ReteTest.java @@ -44,9 +44,9 @@ import org.drools.core.test.model.Cheese; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.kie.api.runtime.rule.FactHandle; import org.kie.internal.conf.CompositeConfiguration; import org.kie.internal.utils.ChainedProperties; @@ -59,7 +59,7 @@ public class ReteTest { private BuildContext buildContext; private EntryPointNode entryPoint; - @Before + @BeforeEach public void setUp() throws Exception { this.kBase = KnowledgeBaseFactory.newKnowledgeBase(); @@ -234,7 +234,7 @@ public void testAssertObjectWithNoMatchingObjectTypeNode() { } @Test - @Ignore + @Disabled public void testHierarchy() { StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newKieSession(); @@ -400,7 +400,7 @@ public void testIsShadowed() { final Object[] results = (Object[]) sink1.getAsserted().get(0); } - @Test @Ignore + @Test @Disabled public void testNotShadowed() { Properties properties = new Properties(); diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/ReteooRuleBaseMultiThreadedTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/ReteooRuleBaseMultiThreadedTest.java index 68509629fbb..440e16c73b4 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/ReteooRuleBaseMultiThreadedTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/ReteooRuleBaseMultiThreadedTest.java @@ -27,9 +27,9 @@ import org.drools.core.rule.consequence.KnowledgeHelper; import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.kie.api.runtime.KieSession; import static org.assertj.core.api.Assertions.assertThat; @@ -44,7 +44,7 @@ public class ReteooRuleBaseMultiThreadedTest { RuleImpl rule; InternalKnowledgePackage pkg; - @Before + @BeforeEach public void setUp() { this.kBase = KnowledgeBaseFactory.newKnowledgeBase(); @@ -72,7 +72,7 @@ public String getName() { kBase.addPackage(pkg); } - @Test @Ignore + @Test @Disabled public void testNewSessionWhileModifyingRuleBase() throws InterruptedException { PackageModifier modifier = new PackageModifier(); SessionCreator creator = new SessionCreator(); diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/ReteooWorkingMemoryTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/ReteooWorkingMemoryTest.java index c59f1f773ac..0d5b5d78205 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/ReteooWorkingMemoryTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/ReteooWorkingMemoryTest.java @@ -42,8 +42,8 @@ import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.EntryPoint; import org.kie.api.runtime.rule.FactHandle; @@ -56,7 +56,7 @@ public class ReteooWorkingMemoryTest { * @see JBRULES-356 */ @Test - @Ignore + @Disabled public void testBasicWorkingMemoryActions() { InternalKnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(); StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newKieSession(); @@ -149,7 +149,7 @@ public void testObjectIterator() { } } - @Test @Ignore + @Test @Disabled public void testExecuteQueueActions() { InternalKnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(); StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newKieSession(); diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/RuleRuntimeEventSupportTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/RuleRuntimeEventSupportTest.java index d3395665cc5..67cdfe0e773 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/RuleRuntimeEventSupportTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/RuleRuntimeEventSupportTest.java @@ -25,7 +25,7 @@ import org.drools.core.event.RuleRuntimeEventSupport; import org.drools.core.test.model.Cheese; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.KieBase; import org.kie.api.event.rule.ObjectDeletedEvent; import org.kie.api.event.rule.ObjectInsertedEvent; diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/RuleUnlinkingTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/RuleUnlinkingTest.java index 9fbafbdcdff..29a61892498 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/RuleUnlinkingTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/RuleUnlinkingTest.java @@ -53,7 +53,7 @@ import org.drools.core.common.PropagationContext; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-kiesession/src/test/java/org/drools/kiesession/RuleUnlinkingWithSegmentMemoryTest.java b/drools-kiesession/src/test/java/org/drools/kiesession/RuleUnlinkingWithSegmentMemoryTest.java index fcd51e7d00c..88e9a965f07 100644 --- a/drools-kiesession/src/test/java/org/drools/kiesession/RuleUnlinkingWithSegmentMemoryTest.java +++ b/drools-kiesession/src/test/java/org/drools/kiesession/RuleUnlinkingWithSegmentMemoryTest.java @@ -53,7 +53,7 @@ import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.KieBaseConfiguration; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-legacy-test-util/pom.xml b/drools-legacy-test-util/pom.xml index e8d1fef3e1e..e90a66d21ea 100644 --- a/drools-legacy-test-util/pom.xml +++ b/drools-legacy-test-util/pom.xml @@ -78,11 +78,11 @@ test-jar test - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + @@ -95,5 +95,4 @@ test - diff --git a/drools-legacy-test-util/src/test/java/org/drools/mvel/compiler/command/MoreBatchExecutionTest.java b/drools-legacy-test-util/src/test/java/org/drools/mvel/compiler/command/MoreBatchExecutionTest.java index 82805ece038..46aa81be59b 100644 --- a/drools-legacy-test-util/src/test/java/org/drools/mvel/compiler/command/MoreBatchExecutionTest.java +++ b/drools-legacy-test-util/src/test/java/org/drools/mvel/compiler/command/MoreBatchExecutionTest.java @@ -25,8 +25,8 @@ import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.mvel.CommonTestMethodBase; import org.drools.mvel.compiler.Cheese; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.kie.api.command.Command; import org.kie.api.io.ResourceType; import org.kie.api.runtime.ExecutionResults; @@ -44,7 +44,7 @@ public class MoreBatchExecutionTest extends CommonTestMethodBase { private KieSession ksession = null; - @After + @AfterEach public void disposeKSession() { if( ksession != null ) { ksession.dispose(); diff --git a/drools-legacy-test-util/src/test/java/org/drools/mvel/compiler/command/SimpleBatchExecutionTest.java b/drools-legacy-test-util/src/test/java/org/drools/mvel/compiler/command/SimpleBatchExecutionTest.java index 7bda60daf17..3cdd0ab39e4 100644 --- a/drools-legacy-test-util/src/test/java/org/drools/mvel/compiler/command/SimpleBatchExecutionTest.java +++ b/drools-legacy-test-util/src/test/java/org/drools/mvel/compiler/command/SimpleBatchExecutionTest.java @@ -26,9 +26,9 @@ import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.mvel.CommonTestMethodBase; -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.command.Command; import org.kie.api.io.ResourceType; import org.kie.api.runtime.ExecutionResults; @@ -53,7 +53,7 @@ public class SimpleBatchExecutionTest extends CommonTestMethodBase { + " then\n" + "end\n"; - @Before + @BeforeEach public void createKSession() throws Exception { final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newByteArrayResource(ruleString.getBytes()), ResourceType.DRL ); @@ -64,7 +64,7 @@ public void createKSession() throws Exception { ksession = createKnowledgeSession(kbase); } - @After + @AfterEach public void disposeKSession() throws Exception { if( ksession != null ) { ksession.dispose(); diff --git a/drools-metric/pom.xml b/drools-metric/pom.xml index 2f946343221..3e66126705d 100644 --- a/drools-metric/pom.xml +++ b/drools-metric/pom.xml @@ -62,6 +62,11 @@ drools-mvel test + + org.junit.jupiter + junit-jupiter + test + org.drools drools-legacy-test-util @@ -83,12 +88,5 @@ logback-classic test - - - junit - junit - test - - diff --git a/drools-metric/src/test/java/org/drools/metric/AbstractMetricTest.java b/drools-metric/src/test/java/org/drools/metric/AbstractMetricTest.java index 94afb25f899..36ce7233029 100644 --- a/drools-metric/src/test/java/org/drools/metric/AbstractMetricTest.java +++ b/drools-metric/src/test/java/org/drools/metric/AbstractMetricTest.java @@ -24,21 +24,21 @@ import org.drools.metric.util.MetricLogUtils; import org.drools.metric.util.MicrometerUtils; import org.drools.mvel.CommonTestMethodBase; -import org.junit.After; -import org.junit.Before; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; abstract class AbstractMetricTest extends CommonTestMethodBase { protected MeterRegistry registry; - @Before + @BeforeEach public void setup() { System.setProperty(MetricLogUtils.METRIC_LOGGER_ENABLED, "true"); System.setProperty(MetricLogUtils.METRIC_LOGGER_THRESHOLD, "-1"); this.registry = Metrics.globalRegistry; } - @After + @AfterEach public void clearMeters() { // Remove meters we inserted without affecting those that may have already been there. Search.in(registry) .name(name -> name.startsWith("org.drools.metric")) diff --git a/drools-metric/src/test/java/org/drools/metric/CloneTest.java b/drools-metric/src/test/java/org/drools/metric/CloneTest.java index 7ac097eaadd..abc068694f3 100644 --- a/drools-metric/src/test/java/org/drools/metric/CloneTest.java +++ b/drools-metric/src/test/java/org/drools/metric/CloneTest.java @@ -18,7 +18,7 @@ */ package org.drools.metric; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.io.ResourceType; import org.kie.api.runtime.KieSession; import org.kie.internal.utils.KieHelper; diff --git a/drools-metric/src/test/java/org/drools/metric/ConstraintsTest.java b/drools-metric/src/test/java/org/drools/metric/ConstraintsTest.java index 4c7a8c25d7f..697132134ae 100644 --- a/drools-metric/src/test/java/org/drools/metric/ConstraintsTest.java +++ b/drools-metric/src/test/java/org/drools/metric/ConstraintsTest.java @@ -22,7 +22,7 @@ import java.util.List; import org.drools.mvel.compiler.Person; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.KieBase; import org.kie.api.runtime.KieSession; diff --git a/drools-metric/src/test/java/org/drools/metric/MetricLogUtilsTest.java b/drools-metric/src/test/java/org/drools/metric/MetricLogUtilsTest.java index 3262031bbec..5b11c16bee2 100644 --- a/drools-metric/src/test/java/org/drools/metric/MetricLogUtilsTest.java +++ b/drools-metric/src/test/java/org/drools/metric/MetricLogUtilsTest.java @@ -29,7 +29,7 @@ import org.drools.metric.util.MetricLogUtils; import org.drools.mvel.compiler.Address; import org.drools.mvel.compiler.Person; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.KieBase; import org.kie.api.runtime.KieSession; diff --git a/drools-mvel/pom.xml b/drools-mvel/pom.xml index df99d589db3..3bd052b2358 100644 --- a/drools-mvel/pom.xml +++ b/drools-mvel/pom.xml @@ -106,6 +106,11 @@ drools-tms test + + org.junit.jupiter + junit-jupiter + test + org.assertj @@ -127,11 +132,6 @@ commons-io test - - junit - junit - test - diff --git a/drools-mvel/src/test/java/org/drools/mvel/BuildUtilsTest.java b/drools-mvel/src/test/java/org/drools/mvel/BuildUtilsTest.java index 692c6450246..387fdaee286 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/BuildUtilsTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/BuildUtilsTest.java @@ -30,8 +30,8 @@ import org.drools.base.time.Interval; import org.drools.core.time.TemporalDependencyMatrix; import org.drools.mvel.evaluators.AfterEvaluatorDefinition; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.drools.base.time.Interval.MAX; @@ -41,7 +41,7 @@ public class BuildUtilsTest { private BuildUtils utils; - @Before + @BeforeEach public void setUp() throws Exception { utils = new BuildUtils(); } diff --git a/drools-mvel/src/test/java/org/drools/mvel/MVELCalendarCoercionTest.java b/drools-mvel/src/test/java/org/drools/mvel/MVELCalendarCoercionTest.java index 748dcaa7eef..f7b420d40f9 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/MVELCalendarCoercionTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/MVELCalendarCoercionTest.java @@ -24,8 +24,8 @@ import java.util.Locale; import org.drools.util.DateUtils; +import org.junit.jupiter.api.Test; import org.drools.mvel.expr.MVELCalendarCoercion; -import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/MVELDateCoercionTest.java b/drools-mvel/src/test/java/org/drools/mvel/MVELDateCoercionTest.java index 9e06729024a..67f314e4ca5 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/MVELDateCoercionTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/MVELDateCoercionTest.java @@ -27,8 +27,8 @@ import org.drools.mvel.MVELConstraintBuilder.StringCoercionCompatibilityEvaluator; import org.drools.util.DateUtils; +import org.junit.jupiter.api.Test; import org.drools.mvel.expr.MVELDateCoercion; -import org.junit.Test; import org.mvel2.DataConversion; import org.mvel2.MVEL; import org.mvel2.ParserContext; diff --git a/drools-mvel/src/test/java/org/drools/mvel/asm/ClassFieldInspectorTest.java b/drools-mvel/src/test/java/org/drools/mvel/asm/ClassFieldInspectorTest.java index ed6aaee232c..419a78505fc 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/asm/ClassFieldInspectorTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/asm/ClassFieldInspectorTest.java @@ -28,7 +28,7 @@ import org.drools.core.util.asm.InterfaceChildImpl; import org.drools.core.util.asm.TestAbstract; import org.drools.core.util.asm.TestInterface; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; diff --git a/drools-mvel/src/test/java/org/drools/mvel/asm/KnowledgeHelperFixerTest.java b/drools-mvel/src/test/java/org/drools/mvel/asm/KnowledgeHelperFixerTest.java index 7f134ae42ed..dd51cb2e5ec 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/asm/KnowledgeHelperFixerTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/asm/KnowledgeHelperFixerTest.java @@ -18,7 +18,7 @@ */ package org.drools.mvel.asm; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/asm/LambdaIntrospectorTest.java b/drools-mvel/src/test/java/org/drools/mvel/asm/LambdaIntrospectorTest.java index 75323f6476c..a77018dcec5 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/asm/LambdaIntrospectorTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/asm/LambdaIntrospectorTest.java @@ -23,7 +23,7 @@ import java.util.function.Supplier; import org.drools.mvel.compiler.Person; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/asm/MethodComparerTest.java b/drools-mvel/src/test/java/org/drools/mvel/asm/MethodComparerTest.java index 955e5134e54..853c71e49e9 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/asm/MethodComparerTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/asm/MethodComparerTest.java @@ -22,7 +22,7 @@ import org.drools.core.util.asm.MethodCompareA; import org.drools.core.util.asm.MethodCompareB; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mvel2.asm.ClassReader; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/asm/ClassGeneratorTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/asm/ClassGeneratorTest.java index da95070e0d3..04d2fb4940e 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/asm/ClassGeneratorTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/asm/ClassGeneratorTest.java @@ -19,7 +19,7 @@ package org.drools.mvel.compiler.rule.builder.dialect.asm; import org.drools.mvel.asm.ClassGenerator; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.mvel2.asm.MethodVisitor; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/asm/InvokerGeneratorTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/asm/InvokerGeneratorTest.java index 49e2435e3de..d805db0561f 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/asm/InvokerGeneratorTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/asm/InvokerGeneratorTest.java @@ -30,7 +30,7 @@ import org.drools.mvel.asm.InvokerContext; import org.drools.mvel.asm.InvokerGenerator; import org.drools.mvel.asm.InvokerStub; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaAccumulateBuilderTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaAccumulateBuilderTest.java index a9d787379fa..f060800c117 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaAccumulateBuilderTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaAccumulateBuilderTest.java @@ -37,8 +37,8 @@ import org.drools.mvel.java.JavaAccumulateBuilder; import org.drools.mvel.java.JavaAnalysisResult; import org.drools.mvel.java.JavaExprAnalyzer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -46,7 +46,7 @@ public class JavaAccumulateBuilderTest { private JavaAccumulateBuilder builder; - @Before + @BeforeEach public void setUp() throws Exception { builder = new JavaAccumulateBuilder(); } diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaConsequenceBuilderPRAlwaysTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaConsequenceBuilderPRAlwaysTest.java index 9df48d8dcdc..17dc1b27f5b 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaConsequenceBuilderPRAlwaysTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaConsequenceBuilderPRAlwaysTest.java @@ -46,7 +46,7 @@ import org.drools.mvel.compiler.Person; import org.drools.mvel.java.JavaAnalysisResult; import org.drools.mvel.java.JavaExprAnalyzer; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.internal.builder.KnowledgeBuilderFactory; import org.kie.internal.builder.conf.PropertySpecificOption; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaConsequenceBuilderTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaConsequenceBuilderTest.java index 47f439c985a..48a77803420 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaConsequenceBuilderTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaConsequenceBuilderTest.java @@ -46,7 +46,7 @@ import org.drools.mvel.compiler.Person; import org.drools.mvel.java.JavaAnalysisResult; import org.drools.mvel.java.JavaExprAnalyzer; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.internal.builder.KnowledgeBuilderFactory; import org.kie.internal.builder.conf.PropertySpecificOption; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaExprAnalyzerTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaExprAnalyzerTest.java index 4b116b27dde..11d00674978 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaExprAnalyzerTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaExprAnalyzerTest.java @@ -25,7 +25,7 @@ import org.drools.compiler.compiler.BoundIdentifiers; import org.drools.mvel.java.JavaAnalysisResult; import org.drools.mvel.java.JavaExprAnalyzer; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaForMvelDialectConfigurationTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaForMvelDialectConfigurationTest.java index f00ff3c2ae2..654ecb2175d 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaForMvelDialectConfigurationTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/java/JavaForMvelDialectConfigurationTest.java @@ -19,7 +19,7 @@ package org.drools.mvel.compiler.rule.builder.dialect.java; import org.drools.mvel.java.JavaForMvelDialectConfiguration; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JavaForMvelDialectConfigurationTest { diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java index 5aefec89e3d..3bd1fd86a4b 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELAccumulateBuilderTest.java @@ -45,7 +45,7 @@ import org.drools.mvel.builder.MVELDialect; import org.drools.mvel.compiler.Cheese; import org.drools.mvel.expr.MVELCompileable; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java index 6e63fa9aac5..84597f88715 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java @@ -83,7 +83,7 @@ import org.drools.mvel.compiler.Cheese; import org.drools.mvel.expr.MVELConsequence; import org.drools.mvel.expr.MVELDebugHandler; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.internal.builder.KnowledgeBuilderFactory; import org.kie.internal.builder.conf.LanguageLevelOption; import org.mvel2.ParserContext; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELDebugTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELDebugTest.java index def1708a344..a5206c26fb0 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELDebugTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELDebugTest.java @@ -24,7 +24,7 @@ import org.drools.drl.ast.descr.RuleDescr; import org.drools.base.definitions.InternalKnowledgePackage; import org.drools.mvel.expr.MVELConsequence; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.internal.builder.conf.LanguageLevelOption; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELEvalBuilderTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELEvalBuilderTest.java index 09a5ae8ab70..a91477920d9 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELEvalBuilderTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELEvalBuilderTest.java @@ -50,8 +50,8 @@ import org.drools.mvel.builder.MVELEvalBuilder; import org.drools.mvel.compiler.Cheese; import org.drools.mvel.expr.MVELEvalExpression; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -59,7 +59,7 @@ public class MVELEvalBuilderTest { ClassFieldAccessorStore store = new ClassFieldAccessorStore(); - @Before + @BeforeEach public void setUp() throws Exception { store.setClassFieldAccessorCache( new ClassFieldAccessorCache( Thread.currentThread().getContextClassLoader() ) ); store.setEagerWire( true ); diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELExprAnalyzerTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELExprAnalyzerTest.java index 919a07b1953..ce2274e5fef 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELExprAnalyzerTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELExprAnalyzerTest.java @@ -19,14 +19,14 @@ package org.drools.mvel.compiler.rule.builder.dialect.mvel; import org.drools.mvel.builder.MVELExprAnalyzer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; public class MVELExprAnalyzerTest { private MVELExprAnalyzer analyzer; - @Before + @BeforeEach public void setUp() throws Exception { analyzer = new MVELExprAnalyzer(); } diff --git a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java index 584439f953e..247c79eb123 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/compiler/rule/builder/dialect/mvel/MVELSalienceBuilderTest.java @@ -55,8 +55,8 @@ import org.drools.mvel.builder.MVELSalienceBuilder; import org.drools.mvel.compiler.Person; import org.drools.mvel.expr.MVELSalienceExpression; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.kie.api.definition.rule.Rule; import static org.assertj.core.api.Assertions.assertThat; @@ -66,7 +66,7 @@ public class MVELSalienceBuilderTest { private InternalKnowledgeBase kBase ; private BuildContext buildContext; - @Before + @BeforeEach public void setUp() throws Exception { InternalKnowledgePackage pkg = CoreComponentFactory.get().createKnowledgePackage( "pkg1" ); final RuleDescr ruleDescr = new RuleDescr( "rule 1" ); diff --git a/drools-mvel/src/test/java/org/drools/mvel/evaluators/TemporalEvaluatorFactoryTest.java b/drools-mvel/src/test/java/org/drools/mvel/evaluators/TemporalEvaluatorFactoryTest.java index d22c95224f8..c99fb7ea1d2 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/evaluators/TemporalEvaluatorFactoryTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/evaluators/TemporalEvaluatorFactoryTest.java @@ -25,6 +25,7 @@ import org.drools.base.base.ValueResolver; import org.drools.mvel.field.FieldFactory; +import org.junit.jupiter.api.Test; import org.drools.base.base.ValueType; import org.drools.compiler.rule.builder.EvaluatorDefinition; import org.drools.compiler.builder.impl.EvaluatorRegistry; @@ -34,7 +35,6 @@ import org.drools.base.rule.accessor.Evaluator; import org.drools.base.rule.accessor.FieldValue; import org.drools.base.rule.accessor.ReadAccessor; -import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/field/FieldFactoryTest.java b/drools-mvel/src/test/java/org/drools/mvel/field/FieldFactoryTest.java index 1d62ec02953..4072d922304 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/field/FieldFactoryTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/field/FieldFactoryTest.java @@ -26,7 +26,7 @@ import org.drools.base.base.ValueType; import org.drools.base.rule.accessor.FieldValue; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-mvel/src/test/java/org/drools/mvel/field/FieldValueTest.java b/drools-mvel/src/test/java/org/drools/mvel/field/FieldValueTest.java index d1722a22f8f..cf6241b9ec7 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/field/FieldValueTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/field/FieldValueTest.java @@ -19,8 +19,8 @@ package org.drools.mvel.field; import org.drools.base.rule.accessor.FieldValue; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -31,7 +31,7 @@ public class FieldValueTest { FieldValue field4; FieldValue field5; - @Before + @BeforeEach public void setUp() throws Exception { this.field1 = FieldFactory.getInstance().getFieldValue( null ); this.field2 = FieldFactory.getInstance().getFieldValue( null ); diff --git a/drools-mvel/src/test/java/org/drools/mvel/integrationtests/LogicTransformerTest.java b/drools-mvel/src/test/java/org/drools/mvel/integrationtests/LogicTransformerTest.java index ec98c674545..85a53153e8c 100644 --- a/drools-mvel/src/test/java/org/drools/mvel/integrationtests/LogicTransformerTest.java +++ b/drools-mvel/src/test/java/org/drools/mvel/integrationtests/LogicTransformerTest.java @@ -33,7 +33,7 @@ import org.drools.base.rule.LogicTransformer; import org.drools.base.rule.Pattern; import org.drools.core.util.DroolsStreamUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-persistence/drools-persistence-jpa/src/test/java/org/drools/persistence/command/MoreBatchExecutionPersistenceTest.java b/drools-persistence/drools-persistence-jpa/src/test/java/org/drools/persistence/command/MoreBatchExecutionPersistenceTest.java index 1610d0563c6..a0864484736 100644 --- a/drools-persistence/drools-persistence-jpa/src/test/java/org/drools/persistence/command/MoreBatchExecutionPersistenceTest.java +++ b/drools-persistence/drools-persistence-jpa/src/test/java/org/drools/persistence/command/MoreBatchExecutionPersistenceTest.java @@ -18,24 +18,41 @@ */ package org.drools.persistence.command; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.Map; import org.drools.core.impl.RuleBaseFactory; -import org.drools.mvel.compiler.command.MoreBatchExecutionTest; +import org.drools.kiesession.rulebase.InternalKnowledgeBase; +import org.drools.kiesession.rulebase.KnowledgeBaseFactory; +import org.drools.mvel.CommonTestMethodBase; +import org.drools.mvel.compiler.Cheese; import org.drools.persistence.util.DroolsPersistenceUtil; import org.junit.After; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.kie.api.KieBase; +import org.kie.api.command.Command; +import org.kie.api.io.ResourceType; import org.kie.api.runtime.Environment; import org.kie.api.runtime.EnvironmentName; +import org.kie.api.runtime.ExecutionResults; +import org.kie.api.runtime.KieSession; import org.kie.api.runtime.KieSessionConfiguration; +import org.kie.api.runtime.rule.QueryResults; +import org.kie.internal.builder.KnowledgeBuilder; +import org.kie.internal.builder.KnowledgeBuilderFactory; +import org.kie.internal.command.CommandFactory; +import org.kie.internal.io.ResourceFactory; import org.kie.internal.persistence.jpa.JPAKnowledgeService; import org.kie.internal.runtime.StatefulKnowledgeSession; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import static org.drools.persistence.util.DroolsPersistenceUtil.DROOLS_PERSISTENCE_UNIT_NAME; import static org.drools.persistence.util.DroolsPersistenceUtil.OPTIMISTIC_LOCKING; import static org.drools.persistence.util.DroolsPersistenceUtil.PESSIMISTIC_LOCKING; @@ -43,7 +60,10 @@ import static org.drools.persistence.util.DroolsPersistenceUtil.createEnvironment; @RunWith(Parameterized.class) -public class MoreBatchExecutionPersistenceTest extends MoreBatchExecutionTest { +public class MoreBatchExecutionPersistenceTest extends CommonTestMethodBase { + + + private KieSession ksession = null; private Map context; private boolean locking; @@ -67,6 +87,13 @@ public void cleanUpPersistence() throws Exception { cleanUp(context); context = null; } + + public void disposeKSession() { + if( ksession != null ) { + ksession.dispose(); + ksession = null; + } + } protected StatefulKnowledgeSession createKnowledgeSession(KieBase kbase) { if( context == null ) { @@ -77,6 +104,72 @@ protected StatefulKnowledgeSession createKnowledgeSession(KieBase kbase) { if( this.locking ) { env.set(EnvironmentName.USE_PESSIMISTIC_LOCKING, true); } - return JPAKnowledgeService.newStatefulKnowledgeSession(kbase, ksconf, env); } + return JPAKnowledgeService.newStatefulKnowledgeSession(kbase, ksconf, env); + + } + + @Test + public void testFireAllRules() { + KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); + kbuilder.add(ResourceFactory.newClassPathResource("org/drools/mvel/integrationtests/drl/test_ImportFunctions.drl"), ResourceType.DRL); + if (kbuilder.hasErrors()) { + fail(kbuilder.getErrors().toString()); + } + InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); + kbase.addPackages(kbuilder.getKnowledgePackages()); + ksession = createKnowledgeSession(kbase); + + final Cheese cheese = new Cheese("stilton", 15); + ksession.insert(cheese); + List list = new ArrayList(); + ksession.setGlobal("list", list); + + List> commands = new ArrayList>(); + commands.add(CommandFactory.newFireAllRules("fired")); + Command cmds = CommandFactory.newBatchExecution(commands); + ExecutionResults result = (ExecutionResults) ksession.execute(cmds); + assertThat(result).as("Batch execution result is null!").isNotNull(); + + Object firedObject = result.getValue("fired"); + assertThat(firedObject instanceof Integer).as("Retrieved object is null or incorrect!").isTrue(); + assertThat(firedObject).isEqualTo(4); + + list = (List) ksession.getGlobal("list"); + assertThat(list.size()).isEqualTo(4); + + assertThat(list.get(0)).isEqualTo("rule1"); + assertThat(list.get(1)).isEqualTo("rule2"); + assertThat(list.get(2)).isEqualTo("rule3"); + assertThat(list.get(3)).isEqualTo("rule4"); + } + + @Test + public void testQuery() { + KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); + kbuilder.add(ResourceFactory.newClassPathResource("org/drools/mvel/integrationtests/simple_query_test.drl"), ResourceType.DRL); + if (kbuilder.hasErrors()) { + fail(kbuilder.getErrors().toString()); + } + InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); + kbase.addPackages(kbuilder.getKnowledgePackages()); + ksession = createKnowledgeSession(kbase); + + ksession.insert( new Cheese( "stinky", 5 ) ); + ksession.insert( new Cheese( "smelly", 7 ) ); + + List> commands = new ArrayList>(); + commands.add(CommandFactory.newQuery("numStinkyCheeses", "simple query")); + Command cmds = CommandFactory.newBatchExecution(commands); + ExecutionResults result = (ExecutionResults) ksession.execute(cmds); + assertThat(result).as("Batch execution result is null!").isNotNull(); + + Object queryResultsObject = result.getValue("numStinkyCheeses"); + assertThat(queryResultsObject instanceof QueryResults).as("Retrieved object is null or incorrect!").isTrue(); + + assertThat(((QueryResults) queryResultsObject).size()).isEqualTo(1); + } + + + } diff --git a/drools-persistence/drools-persistence-jpa/src/test/java/org/drools/persistence/command/SimpleBatchExecutionPersistenceTest.java b/drools-persistence/drools-persistence-jpa/src/test/java/org/drools/persistence/command/SimpleBatchExecutionPersistenceTest.java index c419dc07242..bdce54ea33d 100644 --- a/drools-persistence/drools-persistence-jpa/src/test/java/org/drools/persistence/command/SimpleBatchExecutionPersistenceTest.java +++ b/drools-persistence/drools-persistence-jpa/src/test/java/org/drools/persistence/command/SimpleBatchExecutionPersistenceTest.java @@ -18,26 +18,44 @@ */ package org.drools.persistence.command; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.Map; import org.drools.core.impl.RuleBaseFactory; +import org.drools.kiesession.rulebase.InternalKnowledgeBase; +import org.drools.kiesession.rulebase.KnowledgeBaseFactory; +import org.drools.mvel.CommonTestMethodBase; import org.drools.mvel.compiler.command.SimpleBatchExecutionTest; import org.drools.persistence.util.DroolsPersistenceUtil; import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.kie.api.KieBase; +import org.kie.api.command.Command; +import org.kie.api.io.ResourceType; import org.kie.api.runtime.Environment; import org.kie.api.runtime.EnvironmentName; +import org.kie.api.runtime.ExecutionResults; +import org.kie.api.runtime.KieSession; import org.kie.api.runtime.KieSessionConfiguration; +import org.kie.api.runtime.rule.FactHandle; +import org.kie.internal.builder.KnowledgeBuilder; +import org.kie.internal.builder.KnowledgeBuilderFactory; +import org.kie.internal.command.CommandFactory; +import org.kie.internal.io.ResourceFactory; import org.kie.internal.persistence.jpa.JPAKnowledgeService; import org.kie.internal.runtime.StatefulKnowledgeSession; @RunWith(Parameterized.class) -public class SimpleBatchExecutionPersistenceTest extends SimpleBatchExecutionTest { +public class SimpleBatchExecutionPersistenceTest extends CommonTestMethodBase { private Map context; private boolean locking; @@ -73,4 +91,197 @@ protected StatefulKnowledgeSession createKnowledgeSession(KieBase kbase) { } return JPAKnowledgeService.newStatefulKnowledgeSession(kbase, ksconf, env); } + + private KieSession ksession; + protected final static String ruleString = "" + + "package org.kie.api.persistence \n" + + "global String globalCheeseCountry\n" + + "\n" + + "rule 'EmptyRule' \n" + + " when\n" + + " then\n" + + "end\n"; + + @Before + public void createKSession() throws Exception { + final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); + kbuilder.add( ResourceFactory.newByteArrayResource(ruleString.getBytes()), ResourceType.DRL ); + InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); + assertThat(kbuilder.hasErrors()).isFalse(); + kbase.addPackages( kbuilder.getKnowledgePackages() ); + + ksession = createKnowledgeSession(kbase); + } + + @After + public void disposeKSession() throws Exception { + if( ksession != null ) { + ksession.dispose(); + ksession = null; + } + } + + @Test + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void testInsertObjectCommand() throws Exception { + + String expected_1 = "expected_1"; + String expected_2 = "expected_2"; + + List> commands = new ArrayList>(); + commands.add(CommandFactory.newInsert(expected_1, "out_1")); + commands.add(CommandFactory.newInsert(expected_2, "out_2")); + Command cmds = CommandFactory.newBatchExecution( commands ); + + ExecutionResults result = (ExecutionResults) ksession.execute( cmds ); + + Object fact_1 = result.getValue("out_1"); + assertThat(fact_1).isNotNull(); + Object fact_2 = result.getValue("out_2"); + assertThat(fact_2).isNotNull(); + ksession.fireAllRules(); + + Object [] expectedArr = {expected_1, expected_2}; + List expectedList = new ArrayList(Arrays.asList(expectedArr)); + + Collection factList = ksession.getObjects(); + assertThat(factList.size() == expectedList.size()).as("Expected " + expectedList.size() + " objects but retrieved " + factList.size()).isTrue(); + for( Object fact : factList ) { + expectedList.remove(fact); + } + assertThat(expectedList.isEmpty()).as("Retrieved object list did not contain expected objects.").isTrue(); + } + + @Test + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void testInsertElementsCommand() throws Exception { + + String expected_1 = "expected_1"; + String expected_2 = "expected_2"; + Object [] expectedArr = {expected_1, expected_2}; + Collection factCollection = Arrays.asList(expectedArr); + + List> commands = new ArrayList>(); + commands.add(CommandFactory.newInsertElements(factCollection, "out_list", true, null)); + Command cmds = CommandFactory.newBatchExecution( commands ); + + ExecutionResults result = (ExecutionResults) ksession.execute( cmds ); + + Collection outList = (Collection) result.getValue("out_list"); + assertThat(outList).isNotNull(); + ksession.fireAllRules(); + + List expectedList = new ArrayList(Arrays.asList(expectedArr)); + + Collection factList = ksession.getObjects(); + assertThat(factList.size() == expectedList.size()).as("Expected " + expectedList.size() + " objects but retrieved " + factList.size()).isTrue(); + for( Object fact : factList ) { + expectedList.remove(fact); + } + assertThat(expectedList.isEmpty()).as("Retrieved object list did not contain expected objects.").isTrue(); + } + + @Test + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void testSetGlobalCommand() throws Exception { + + ksession.insert(new Integer(5)); + ksession.insert(new Integer(7)); + ksession.fireAllRules(); + + List> commands = new ArrayList>(); + commands.add(CommandFactory.newSetGlobal( "globalCheeseCountry", "France", true )); + + Command cmds = CommandFactory.newBatchExecution( commands ); + + ExecutionResults result = (ExecutionResults) ksession.execute( cmds ); + assertThat(result).isNotNull(); + Object global = result.getValue("globalCheeseCountry"); + assertThat(global).isNotNull(); + assertThat(global).isEqualTo("France"); + } + + @Test + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void testGetGlobalCommand() throws Exception { + + ksession.insert(new Integer(5)); + ksession.insert(new Integer(7)); + ksession.fireAllRules(); + ksession.setGlobal("globalCheeseCountry", "France"); + + List> commands = new ArrayList>(); + commands.add(CommandFactory.newGetGlobal( "globalCheeseCountry", "cheeseCountry" )); + Command cmds = CommandFactory.newBatchExecution( commands ); + + ExecutionResults result = (ExecutionResults) ksession.execute( cmds ); + assertThat(result).as("GetGlobalCommand result is null!").isNotNull(); + Object global = result.getValue("cheeseCountry"); + assertThat(global).as("Retrieved global fact is null!").isNotNull(); + assertThat(global).as("Retrieved global is not equal to 'France'.").isEqualTo("France"); + } + + @Test + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void testGetObjectCommand() throws Exception { + + String expected_1 = "expected_1"; + String expected_2 = "expected_2"; + FactHandle handle_1 = ksession.insert( expected_1 ); + FactHandle handle_2 = ksession.insert( expected_2 ); + ksession.fireAllRules(); + + Object fact = ksession.getObject(handle_1); + assertThat(fact).isNotNull(); + assertThat(fact).isEqualTo(expected_1); + + List> commands = new ArrayList>(); + commands.add(CommandFactory.newGetObject(handle_1, "out_1")); + commands.add(CommandFactory.newGetObject(handle_2, "out_2")); + Command cmds = CommandFactory.newBatchExecution( commands ); + + ExecutionResults result = (ExecutionResults) ksession.execute( cmds ); + assertThat(result).as("GetObjectCommand result is null!").isNotNull(); + + assertThat(result.getValue("out_1")).isEqualTo(expected_1); + assertThat(result.getValue("out_2")).isEqualTo(expected_2); + } + + @Test + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void testGetObjectsCommand() throws Exception { + + String expected_1 = "expected_1"; + String expected_2 = "expected_2"; + FactHandle handle_1 = ksession.insert( expected_1 ); + FactHandle handle_2 = ksession.insert( expected_2 ); + ksession.fireAllRules(); + + Object object = ksession.getObject(handle_1); + assertThat(object).isNotNull(); + assertThat(object).isEqualTo(expected_1); + object = ksession.getObject(handle_2); + assertThat(object).isNotNull(); + assertThat(object).isEqualTo(expected_2); + + List> commands = new ArrayList>(); + commands.add(CommandFactory.newGetObjects("out_list")); + Command cmds = CommandFactory.newBatchExecution( commands ); + + ExecutionResults result = (ExecutionResults) ksession.execute( cmds ); + assertThat(result).as("GetObjectsCommand result is null!").isNotNull(); + + List objectList = (List) result.getValue("out_list"); + assertThat(objectList != null && !objectList.isEmpty()).as("Retrieved object list is null or empty!").isTrue(); + + Collection factList = ksession.getObjects(); + Object [] expectedArr = {expected_1, expected_2}; + List expectedList = new ArrayList(Arrays.asList(expectedArr)); + assertThat(factList.size() == expectedList.size()).as("Expected " + expectedList.size() + " objects but retrieved " + factList.size()).isTrue(); + for( Object fact : factList ) { + expectedList.remove(fact); + } + assertThat(expectedList.isEmpty()).as("Retrieved object list did not contain expected objects.").isTrue(); + } + } diff --git a/drools-templates/pom.xml b/drools-templates/pom.xml index 9194b46c1d4..286ae1e329c 100644 --- a/drools-templates/pom.xml +++ b/drools-templates/pom.xml @@ -79,13 +79,13 @@ test - org.assertj - assertj-core + org.junit.jupiter + junit-jupiter test - junit - junit + org.assertj + assertj-core test diff --git a/drools-templates/src/test/java/org/drools/template/DataProviderCompilerTest.java b/drools-templates/src/test/java/org/drools/template/DataProviderCompilerTest.java index b95278bf3fa..83eb143b444 100644 --- a/drools-templates/src/test/java/org/drools/template/DataProviderCompilerTest.java +++ b/drools-templates/src/test/java/org/drools/template/DataProviderCompilerTest.java @@ -29,8 +29,8 @@ import org.drools.template.parser.Column; import org.drools.template.parser.DefaultTemplateContainer; import org.drools.template.parser.TemplateContainer; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -83,7 +83,7 @@ public String[] next() { private ArrayList rows = new ArrayList(); - @Before + @BeforeEach public void setUp() { rows.add(new String[]{"1", "STANDARD", diff --git a/drools-templates/src/test/java/org/drools/template/jdbc/ResultSetGeneratorTest.java b/drools-templates/src/test/java/org/drools/template/jdbc/ResultSetGeneratorTest.java index 7c91b775bcd..734d24af853 100644 --- a/drools-templates/src/test/java/org/drools/template/jdbc/ResultSetGeneratorTest.java +++ b/drools-templates/src/test/java/org/drools/template/jdbc/ResultSetGeneratorTest.java @@ -29,7 +29,7 @@ import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.kie.api.io.ResourceType; import org.kie.api.runtime.KieSession; import org.kie.internal.builder.KnowledgeBuilder; diff --git a/drools-templates/src/test/java/org/drools/template/model/FunctionsRenderTest.java b/drools-templates/src/test/java/org/drools/template/model/FunctionsRenderTest.java index 0430fe73ce3..6fe6dc6de55 100644 --- a/drools-templates/src/test/java/org/drools/template/model/FunctionsRenderTest.java +++ b/drools-templates/src/test/java/org/drools/template/model/FunctionsRenderTest.java @@ -18,7 +18,7 @@ */ package org.drools.template.model; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-templates/src/test/java/org/drools/template/model/PackageRenderTest.java b/drools-templates/src/test/java/org/drools/template/model/PackageRenderTest.java index f9740107474..9f67e1b11a3 100644 --- a/drools-templates/src/test/java/org/drools/template/model/PackageRenderTest.java +++ b/drools-templates/src/test/java/org/drools/template/model/PackageRenderTest.java @@ -18,7 +18,7 @@ */ package org.drools.template.model; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-templates/src/test/java/org/drools/template/model/QueriesRenderTest.java b/drools-templates/src/test/java/org/drools/template/model/QueriesRenderTest.java index 65bf5da351f..e8747074b8d 100644 --- a/drools-templates/src/test/java/org/drools/template/model/QueriesRenderTest.java +++ b/drools-templates/src/test/java/org/drools/template/model/QueriesRenderTest.java @@ -18,7 +18,7 @@ */ package org.drools.template.model; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-templates/src/test/java/org/drools/template/model/RuleRenderTest.java b/drools-templates/src/test/java/org/drools/template/model/RuleRenderTest.java index 352156512d9..f1f1629dadf 100644 --- a/drools-templates/src/test/java/org/drools/template/model/RuleRenderTest.java +++ b/drools-templates/src/test/java/org/drools/template/model/RuleRenderTest.java @@ -18,7 +18,7 @@ */ package org.drools.template.model; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-templates/src/test/java/org/drools/template/model/SnippetBuilderTest.java b/drools-templates/src/test/java/org/drools/template/model/SnippetBuilderTest.java index 4c30ec31e82..945d496d794 100644 --- a/drools-templates/src/test/java/org/drools/template/model/SnippetBuilderTest.java +++ b/drools-templates/src/test/java/org/drools/template/model/SnippetBuilderTest.java @@ -18,7 +18,7 @@ */ package org.drools.template.model; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-templates/src/test/java/org/drools/template/parser/ColumnFactoryTest.java b/drools-templates/src/test/java/org/drools/template/parser/ColumnFactoryTest.java index 1a42ef0c864..cd9c2566025 100644 --- a/drools-templates/src/test/java/org/drools/template/parser/ColumnFactoryTest.java +++ b/drools-templates/src/test/java/org/drools/template/parser/ColumnFactoryTest.java @@ -18,7 +18,7 @@ */ package org.drools.template.parser; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; diff --git a/drools-templates/src/test/java/org/drools/template/parser/DefaultGeneratorTest.java b/drools-templates/src/test/java/org/drools/template/parser/DefaultGeneratorTest.java index d9d6e3cd7e2..98f2028bef0 100644 --- a/drools-templates/src/test/java/org/drools/template/parser/DefaultGeneratorTest.java +++ b/drools-templates/src/test/java/org/drools/template/parser/DefaultGeneratorTest.java @@ -18,8 +18,8 @@ */ package org.drools.template.parser; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.Map; @@ -29,7 +29,7 @@ public class DefaultGeneratorTest { private DefaultGenerator g; - @Before + @BeforeEach public void setUp() throws Exception { Map t = new HashMap(); TemplateContainer tc = new TemplateContainer() { diff --git a/drools-templates/src/test/java/org/drools/template/parser/DefaultTemplateContainerTest.java b/drools-templates/src/test/java/org/drools/template/parser/DefaultTemplateContainerTest.java index c2fe0d302d0..1c7379e24c5 100644 --- a/drools-templates/src/test/java/org/drools/template/parser/DefaultTemplateContainerTest.java +++ b/drools-templates/src/test/java/org/drools/template/parser/DefaultTemplateContainerTest.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; diff --git a/drools-templates/src/test/java/org/drools/template/parser/ExternalSheetListenerTest.java b/drools-templates/src/test/java/org/drools/template/parser/ExternalSheetListenerTest.java index b605305d2d1..66af096e4a3 100644 --- a/drools-templates/src/test/java/org/drools/template/parser/ExternalSheetListenerTest.java +++ b/drools-templates/src/test/java/org/drools/template/parser/ExternalSheetListenerTest.java @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.kie.api.KieBase; import org.kie.api.command.Command; import org.kie.api.event.process.ProcessEventListener; @@ -54,7 +54,7 @@ public class ExternalSheetListenerTest { private List assertedRows = new ArrayList<>(); - @Before + @BeforeEach public void setUp() throws Exception { esl = new TemplateDataListener(2, 2, new TestTemplateContainer(), new TestGenerator()); } diff --git a/drools-templates/src/test/java/org/drools/template/parser/RuleTemplateTest.java b/drools-templates/src/test/java/org/drools/template/parser/RuleTemplateTest.java index ea62ee85729..344ff92377f 100644 --- a/drools-templates/src/test/java/org/drools/template/parser/RuleTemplateTest.java +++ b/drools-templates/src/test/java/org/drools/template/parser/RuleTemplateTest.java @@ -19,7 +19,7 @@ package org.drools.template.parser; import org.drools.util.StringUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; import java.util.Map; diff --git a/drools-tms/pom.xml b/drools-tms/pom.xml index a04ae00e2a1..a454a1b2d92 100644 --- a/drools-tms/pom.xml +++ b/drools-tms/pom.xml @@ -97,12 +97,11 @@ drools-wiring-dynamic test - - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + org.assertj assertj-core @@ -115,5 +114,4 @@ - diff --git a/drools-tms/src/test/java/org/drools/tms/EqualityKeyTest.java b/drools-tms/src/test/java/org/drools/tms/EqualityKeyTest.java index c584a4a2bae..0e869e8e9b2 100644 --- a/drools-tms/src/test/java/org/drools/tms/EqualityKeyTest.java +++ b/drools-tms/src/test/java/org/drools/tms/EqualityKeyTest.java @@ -22,7 +22,7 @@ import org.drools.core.common.InternalFactHandle; import org.drools.core.reteoo.ReteooFactHandleFactory; import org.drools.core.test.model.Cheese; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-tms/src/test/java/org/drools/tms/LazyTMSEnablingTest.java b/drools-tms/src/test/java/org/drools/tms/LazyTMSEnablingTest.java index 089d154546e..12389353de3 100644 --- a/drools-tms/src/test/java/org/drools/tms/LazyTMSEnablingTest.java +++ b/drools-tms/src/test/java/org/drools/tms/LazyTMSEnablingTest.java @@ -24,8 +24,8 @@ import org.drools.kiesession.rulebase.InternalKnowledgeBase; import org.drools.kiesession.rulebase.KnowledgeBaseFactory; import org.drools.kiesession.session.StatefulKnowledgeSessionImpl; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -46,7 +46,7 @@ public class LazyTMSEnablingTest { private StatefulKnowledgeSessionImpl ksession; private TruthMaintenanceSystem tms; - @Before + @BeforeEach public void setUp() { InternalKnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(); ksession = (StatefulKnowledgeSessionImpl)kBase.newKieSession(); diff --git a/drools-wiring/drools-wiring-api/pom.xml b/drools-wiring/drools-wiring-api/pom.xml index ae3a1228f74..cb88a2d26d4 100755 --- a/drools-wiring/drools-wiring-api/pom.xml +++ b/drools-wiring/drools-wiring-api/pom.xml @@ -61,11 +61,11 @@ assertj-core test - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-wiring/drools-wiring-api/src/test/java/org/drools/wiring/api/classloader/ProjectClassLoaderTest.java b/drools-wiring/drools-wiring-api/src/test/java/org/drools/wiring/api/classloader/ProjectClassLoaderTest.java index 15f7cfbd800..a90c8739e12 100644 --- a/drools-wiring/drools-wiring-api/src/test/java/org/drools/wiring/api/classloader/ProjectClassLoaderTest.java +++ b/drools-wiring/drools-wiring-api/src/test/java/org/drools/wiring/api/classloader/ProjectClassLoaderTest.java @@ -18,7 +18,7 @@ */ package org.drools.wiring.api.classloader; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/drools-wiring/drools-wiring-dynamic/pom.xml b/drools-wiring/drools-wiring-dynamic/pom.xml index 355a9d666df..58d833d294a 100755 --- a/drools-wiring/drools-wiring-dynamic/pom.xml +++ b/drools-wiring/drools-wiring-dynamic/pom.xml @@ -83,11 +83,11 @@ logback-classic test - - junit - junit - test - + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-wiring/drools-wiring-dynamic/src/test/java/org/drools/dynamic/ClassLoaderTest.java b/drools-wiring/drools-wiring-dynamic/src/test/java/org/drools/dynamic/ClassLoaderTest.java index a120c4f390e..dd92b9d5188 100755 --- a/drools-wiring/drools-wiring-dynamic/src/test/java/org/drools/dynamic/ClassLoaderTest.java +++ b/drools-wiring/drools-wiring-dynamic/src/test/java/org/drools/dynamic/ClassLoaderTest.java @@ -24,13 +24,16 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; import org.drools.wiring.api.classloader.ProjectClassLoader; -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; public class ClassLoaderTest { - @Test(timeout = 20000) + @Test + @Timeout(value = 20000, unit = TimeUnit.MILLISECONDS) public void testParallelClassLoading() { final int THREAD_COUNT = 100; diff --git a/drools-wiring/drools-wiring-static/pom.xml b/drools-wiring/drools-wiring-static/pom.xml index 07bd2d42bdb..8f56b762329 100755 --- a/drools-wiring/drools-wiring-static/pom.xml +++ b/drools-wiring/drools-wiring-static/pom.xml @@ -62,16 +62,16 @@ logback-classic test - - junit - junit - test - org.assertj assertj-core test + + org.junit.jupiter + junit-jupiter + test + diff --git a/drools-wiring/drools-wiring-static/src/test/java/org/drools/wiring/statics/DummyByteArrayClassLoaderTest.java b/drools-wiring/drools-wiring-static/src/test/java/org/drools/wiring/statics/DummyByteArrayClassLoaderTest.java index 0c7eafc483a..024f6d2b695 100644 --- a/drools-wiring/drools-wiring-static/src/test/java/org/drools/wiring/statics/DummyByteArrayClassLoaderTest.java +++ b/drools-wiring/drools-wiring-static/src/test/java/org/drools/wiring/statics/DummyByteArrayClassLoaderTest.java @@ -18,7 +18,7 @@ */ package org.drools.wiring.statics; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThatThrownBy;