Skip to content

Commit

Permalink
Migrated to junit5. Cleanup of assertj assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
pibizza committed Sep 6, 2024
1 parent 6be58bc commit 323b89c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
10 changes: 5 additions & 5 deletions drools-commands/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
<artifactId>jakarta.xml.bind-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import org.drools.commands.runtime.rule.InsertObjectCommand;
import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
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.runtime.Context;
import org.kie.api.runtime.ExecutableRunner;
import org.kie.api.runtime.KieSession;
Expand All @@ -40,15 +40,15 @@ public class DeleteCommandTest {
private ExecutableRunner<RequestContext> runner;
private Context context;

@Before
@BeforeEach
public void setup() {
InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
ksession = kbase.newKieSession();
runner = ExecutableRunner.create();
context = ((RegistryContext) runner.createContext()).register(KieSession.class, ksession);
}

@After
@AfterEach
public void cleanUp() {
ksession.dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.drools.core.common.DefaultFactHandle;
import org.drools.commands.runtime.ExecutionResultImpl;
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.command.BatchExecutionCommand;
import org.kie.api.runtime.ExecutableRunner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
import org.drools.commands.runtime.rule.FromExternalFactHandleCommand;
import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
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.kie.api.runtime.Context;
import org.kie.api.runtime.ExecutableRunner;
import org.kie.api.runtime.KieSession;
Expand All @@ -39,20 +38,20 @@ public class FromExternalFactHandleCommandTest {
private ExecutableRunner<RequestContext> runner;
private Context context;

@Before
@BeforeEach
public void setup() {
InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
ksession = kbase.newKieSession();
runner = ExecutableRunner.create();
context = ((RegistryContext) runner.createContext()).register(KieSession.class, ksession);
}

@After
@AfterEach
public void cleanUp() {
ksession.dispose();
}

@Test
@org.junit.jupiter.api.Test
public void testFromExternalFactHandleCommandNumberFormatException() {
// DROOLS-7076 : Just to test not to throw NumberFormatException
String externalFormat = "0:2147483648:171497379:-1361525545:2147483648:null:NON_TRAIT:java.lang.String";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import org.drools.core.common.InternalFactHandle;
import org.drools.kiesession.rulebase.InternalKnowledgeBase;
import org.drools.kiesession.rulebase.KnowledgeBaseFactory;
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.runtime.Context;
import org.kie.api.runtime.ExecutableRunner;
import org.kie.api.runtime.KieSession;
Expand All @@ -47,15 +47,15 @@ public class GetFactHandlesCommandTest {
private Context context;
private Random random = new Random();

@Before
@BeforeEach
public void setup() {
InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
ksession = kbase.newKieSession();
runner = ExecutableRunner.create();
context = ( (RegistryContext) runner.createContext() ).register( KieSession.class, ksession );
}

@After
@AfterEach
public void cleanUp() {
ksession.dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.drools.commands.fluent.BatchImpl;
import org.drools.commands.fluent.InternalExecutable;
import org.drools.commands.impl.NotTransactionalCommand;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.command.ExecutableCommand;
import org.kie.api.runtime.Context;

Expand Down

0 comments on commit 323b89c

Please sign in to comment.