/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ @Factory public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers) { return anyOf(Arrays.asList(matchers)); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ @Factory public static <T> AnyOf<T> anyOf(Iterable<Matcher<? super T>> matchers) { return new AnyOf<T>(matchers); }
@Override public boolean matches(Object o) { return matches(o, true); }
@Test public void specificCompensationOfASubProcess() throws Exception { KieSession ksession = createKnowledgeSession("compensation/BPMN2-Compensation-ThrowSpecificForSubProcess.bpmn2"); TestWorkItemHandler workItemHandler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", workItemHandler); Map<String, Object> params = new HashMap<String, Object>(); params.put("x", 1); ProcessInstance processInstance = ksession.startProcess("CompensationSpecificSubProcess", params); // compensation activity (assoc. with script task) signaled *after* to-compensate script task assertProcessInstanceCompleted(processInstance.getId(), ksession); if( ! isPersistence() ) { assertProcessVarValue(processInstance, "x", null); } else { // We need to check it this way because of some databases like Oracle RAC etc. List<VariableInstanceLog> logs = logService.findVariableInstances(processInstance.getId(), "x"); List<String> values = logs.stream().map(VariableInstanceLog::getValue).collect(Collectors.toList()); assertThat(values, IsCollectionContaining.hasItem(AnyOf.anyOf(Is.is(" "), Is.is(""), Is.is((String) null)))); } }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<T> first, org.hamcrest.Matcher<? super T> second) { return org.hamcrest.core.AnyOf.<T>anyOf(first, second); }
@Override public void describeTo(Description description) { describeTo(description, "or"); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> AnyOf<T> anyOf(Iterable<Matcher<? super T>> matchers) { return new AnyOf<>(matchers); }
private static GraphTraversal<Vertex, Long> getTraversalWithLambda(final GraphTraversalSource g) { assumeThat("This test is not enabled for this ScriptEngine: " + ENGINE_TO_TEST, ENGINE_TO_TEST, anyOf(is("gremlin-python"), is("gremlin-jython"), is("gremlin-groovy"))); if (ENGINE_TO_TEST.equals("gremlin-groovy")) return g.V().out("created").map(Lambda.function("{x -> x.get().values('name')}")).count(); else if (ENGINE_TO_TEST.equals("gremlin-python") || ENGINE_TO_TEST.equals("gremlin-jython")) return g.V().out("created").map(Lambda.function("x : x.get().values('name')")).count(); else throw new RuntimeException("The " + ENGINE_TO_TEST + " ScriptEngine is not supported by this test"); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<T> first, org.hamcrest.Matcher<? super T> second, org.hamcrest.Matcher<? super T> third) { return org.hamcrest.core.AnyOf.<T>anyOf(first, second, third); }
@Override public void describeTo(Description description) { describeTo(description, "or"); }
public CombinableMatcher<T> or(Matcher<? super T> other) { return new CombinableMatcher<T>(new AnyOf<T>(templatedListWith(other))); }
private static GraphTraversal<Vertex, Long> getTraversalWithLambda(final GraphTraversalSource g) { assumeThat("This test is not enabled for this ScriptEngine: " + ENGINE_TO_TEST, ENGINE_TO_TEST, anyOf(is("gremlin-python"), is("gremlin-jython"), is("gremlin-groovy"))); if (ENGINE_TO_TEST.equals("gremlin-groovy")) return g.V().out("created").map(Lambda.function("{x -> x.get().values('name')}")).count(); else if (ENGINE_TO_TEST.equals("gremlin-python") || ENGINE_TO_TEST.equals("gremlin-jython")) return g.V().out("created").map(Lambda.function("x : x.get().values('name')")).count(); else throw new RuntimeException("The " + ENGINE_TO_TEST + " ScriptEngine is not supported by this test"); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ @Factory public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers) { return anyOf(Arrays.asList(matchers)); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ @Factory public static <T> AnyOf<T> anyOf(Iterable<Matcher<? super T>> matchers) { return new AnyOf<T>(matchers); }
/** * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers. * <p/> * For example: * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre> */ public static <T> org.hamcrest.core.AnyOf<T> anyOf(org.hamcrest.Matcher<? super T>... matchers) { return org.hamcrest.core.AnyOf.<T>anyOf(matchers); }
@Override public boolean matches(Object o) { return matches(o, true); }
@Override public void describeTo(Description description) { describeTo(description, "or"); }
public CombinableMatcher<T> or(Matcher<? super T> other) { return new CombinableMatcher<T>(new AnyOf<T>(templatedListWith(other))); }
TupleQueryResult result = testCon.prepareTupleQuery(QueryLanguage.SPARQL, queryBuilder.toString()).evaluate(); try { assertThat(result, is(notNullValue())); assertThat(result.hasNext(), is(equalTo(true))); while (result.hasNext()) { BindingSet solution = result.next(); assertThat(solution.hasBinding(NAME), is(equalTo(true))); assertThat(solution.hasBinding(MBOX), is(equalTo(true))); Value nameResult = solution.getValue(NAME); Value mboxResult = solution.getValue(MBOX); assertThat(nameResult, anyOf(is(equalTo((Value)nameAlice)), is(equalTo((Value)nameBob)))); assertThat(mboxResult, anyOf(is(equalTo((Value)mboxAlice)), is(equalTo((Value)mboxBob))));