org.junit.jupiter.api.function.ThrowingSupplier Java Examples

The following examples show how to use org.junit.jupiter.api.function.ThrowingSupplier. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NamedConsequencesTest.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoLoop() {
    // DROOLS-644
    String drl =
            "import " + Person.class.getCanonicalName() + ";\n" +
            "global java.util.List list;\n" +
            "rule R no-loop when\n" +
            "    $p1 : Person( name == \"Mario\" ) do[t1]\n" +
            "    $p2 : Person( age > $p1.age )\n" +
            "then\n" +
            "    list.add(\"t0\");\n" +
            "    modify($p2) { setAge(30); }\n" +
            "then[t1]\n" +
            "    list.add(\"t1\");\n" +
            "    modify($p1) { setAge(35); }\n" +
            "end\n";

    // This test has uncovered a BLOCKER which is reported in the PropertyReactiveBlockersTest
    KieSession ksession = new KieHelper(PropertySpecificOption.ALLOWED).addContent(drl, ResourceType.DRL)
            .build()
            .newKieSession();

    List<String> list = new ArrayList<String>();
    ksession.setGlobal("list", list);

    Person mario = new Person("Mario", 40);
    Person mark = new Person("Mark", 37);
    ksession.insert(mario);
    ksession.insert(mark);
    assertTimeoutPreemptively(Duration.ofSeconds(10), (ThrowingSupplier<Integer>) ksession::fireAllRules);

    assertEquals(35, mario.getAge());
    assertEquals(30, mark.getAge());

    assertEquals(2, list.size());
    assertEquals("t1", list.get(0));
    assertEquals("t0", list.get(1));
}
 
Example #2
Source File: ProblemAdapterFactoryTest.java    From problem with MIT License 4 votes vote down vote up
@Test
void defaultConstructorShouldBuildIndexCorrectly() {
    assertDoesNotThrow((ThrowingSupplier<ProblemAdapterFactory>) ProblemAdapterFactory::new);
}
 
Example #3
Source File: MemoryReferenceTask.java    From james-project with Apache License 2.0 4 votes vote down vote up
public MemoryReferenceTask(ThrowingSupplier<Result> task) {
    this.task = task;
}