List of usage examples for java.util.function Predicate test
boolean test(T t);
From source file:org.jephyr.easyflow.instrument.AnalyzingMethodRefPredicateTest.java
@Test public void testApplyMethodWithCallStatic() throws Exception { Predicate<MethodRef> predicate = new AnalyzingMethodRefPredicate(getBytes(Static.class), TRUE_PREDICATE); assertFalse(predicate.test(getMethodRef(Static.class.getDeclaredMethod("m")))); }
From source file:org.jephyr.easyflow.instrument.AnalyzingMethodRefPredicateTest.java
@Test public void testApplyMethodWithCall() throws Exception { class C {// w ww. j a v a 2s . c o m void m() { m2(); } void m2() { } } Predicate<MethodRef> predicate = new AnalyzingMethodRefPredicate(getBytes(C.class), TRUE_PREDICATE); assertTrue(predicate.test(getMethodRef(C.class.getDeclaredMethod("m")))); }
From source file:org.jephyr.easyflow.instrument.AnalyzingMethodRefPredicateTest.java
@Test public void testApplyMethodWithCallFinalClass() throws Exception { final class C { void m() { m2();/*from w ww . j a v a2 s .c o m*/ } void m2() { } } Predicate<MethodRef> predicate = new AnalyzingMethodRefPredicate(getBytes(C.class), TRUE_PREDICATE); assertFalse(predicate.test(getMethodRef(C.class.getDeclaredMethod("m")))); }
From source file:org.jephyr.easyflow.instrument.AnalyzingMethodRefPredicateTest.java
@Test public void testApplyMethodWithCallPrivate() throws Exception { class C {/*from w w w . jav a 2 s .c o m*/ void m() { m2(); } private void m2() { } } Predicate<MethodRef> predicate = new AnalyzingMethodRefPredicate(getBytes(C.class), TRUE_PREDICATE); assertFalse(predicate.test(getMethodRef(C.class.getDeclaredMethod("m")))); }
From source file:org.jephyr.easyflow.instrument.AnalyzingMethodRefPredicateTest.java
@Test public void testApplyMethodWithCallFinal() throws Exception { class C {//from w w w . ja v a 2 s. com void m() { m2(); } final void m2() { } } Predicate<MethodRef> predicate = new AnalyzingMethodRefPredicate(getBytes(C.class), TRUE_PREDICATE); assertFalse(predicate.test(getMethodRef(C.class.getDeclaredMethod("m")))); }
From source file:org.jephyr.easyflow.instrument.AnalyzingMethodRefPredicateTest.java
@Test public void testApplyMethodWithCallRecursion() throws Exception { class C {//from w ww. ja va 2s .c o m void m1() { m2(); } private void m2() { m1(); } } Predicate<MethodRef> predicate = new AnalyzingMethodRefPredicate(getBytes(C.class), TRUE_PREDICATE); assertTrue(predicate.test(getMethodRef(C.class.getDeclaredMethod("m1")))); assertTrue(predicate.test(getMethodRef(C.class.getDeclaredMethod("m2")))); }
From source file:org.jephyr.easyflow.instrument.AnalyzingMethodRefPredicateTest.java
@Test public void testApplyMethodWithCallRecursionPrivate() throws Exception { class C {/* ww w .jav a 2s . c o m*/ private void m1() { m2(); } private void m2() { m1(); } } Predicate<MethodRef> predicate = new AnalyzingMethodRefPredicate(getBytes(C.class), TRUE_PREDICATE); assertFalse(predicate.test(getMethodRef(C.class.getDeclaredMethod("m1")))); assertFalse(predicate.test(getMethodRef(C.class.getDeclaredMethod("m2")))); }
From source file:org.openhab.binding.yamahareceiver.internal.protocol.xml.DeviceDescriptorXML.java
/** * Checks if the condition is met, on false result calls the runnable. * * @param predicate/*from w ww.ja v a 2s.com*/ * @param falseAction * @return */ public boolean hasFeature(Predicate<DeviceDescriptorXML> predicate, Runnable falseAction) { boolean result = predicate.test(this); if (!result) { falseAction.run(); } return result; }
From source file:org.diorite.impl.PlayersManagerImpl.java
public void forEachExcept(final Player except, final Predicate<IPlayer> predicate, final Packet<?> packet) { //noinspection ObjectEquality this.forEach(p -> (p != except) && predicate.test(p), player -> player.getNetworkManager().sendPacket(packet)); }
From source file:org.diorite.impl.PlayersManagerImpl.java
public void forEachExcept(final Player except, final Predicate<IPlayer> predicate, final Packet<?>[] packets) { //noinspection ObjectEquality this.forEach(p -> (p != except) && predicate.test(p), player -> player.getNetworkManager().sendPackets(packets)); }