/** * Creates an and matcher combining this matcher and the given one * @param matcher The matcher to be put in and with this one * @return A matcher that return true if this matcher and the passed one return true */ @SuppressWarnings("unchecked") public final LambdaJMatcher<T> and(Matcher<T> matcher) { return AndMatcher.and(this, matcher); }
/** * Creates an hamcrest matcher that is evalued to true if the value of the given argument satisfies * the condition defined by the passed matcher. * @param argument The argument defined using the {@link Lambda#on(Class)} method that has to be matched * @param matcher The matcher against which the value of the given argument has to be compared * @return The hamcrest matcher that is evalued to true if the value of the passed argument matches the given matcher */ public static <T, A> HasArgumentWithValue<T, A> having(A argument, Matcher<?> matcher) { return havingValue(argument, matcher); }
/** * {@inheritDoc} */ public final boolean matches(Object item) { return innerMatcher.matches(item); }
public ManagedMongoDbLifecycleManager getStartedServer(int port) { return selectFirst( this.servers, having(on(ManagedMongoDbLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(true)))); }
/** * Creates an or matcher combining this matcher and the given one * @param matcher The matcher to be put in or with this one * @return A matcher that return true if this matcher or the passed one return true */ @SuppressWarnings("unchecked") public final LambdaJMatcher<T> or(Matcher<T> matcher) { return OrMatcher.or(this, matcher); }
/** * Creates an and matcher combining all the passed matchers * @param matchers The matchers to be put in and * @return A matcher that return true if all the matchers return true */ @Factory public static <T> AndMatcher<T> and(Matcher<T>... matchers) { return new AndMatcher<T>(matchers); } }
/** * Creates an or matcher combining all the passed matchers * @param matchers The matchers to be put in or * @return A matcher that return true if at least one of the matchers return true */ @Factory public static <T> OrMatcher<T> or(Matcher<T>... matchers) { return new OrMatcher<T>(matchers); } }
/** * Creates a matcher that returns true if the value af the named property matches the given matcher * @param propertyName The name of the property * @param value The value to be mathced * @return A matcher that returns true if the value af the named property matches the given matcher */ @Factory public static <T> Matcher<T> hasNestedProperty(String propertyName, Matcher<?> value) { return new HasNestedPropertyWithValue<T>(propertyName, value); } }
/** * Creates an hamcrest matcher that is evalued to true if the value of the given argument satisfies * the condition defined by the passed matcher. * @param argument The argument defined using the {@link ch.lambdaj.Lambda#on(Class)} method that has to be matched * @param matcher The matcher against which the value of the given argument has to be compared * @return The hamcrest matcher that is evalued to true if the value of the passed argument matches the given matcher */ @Factory public static <T, A> HasArgumentWithValue<T, A> havingValue(A argument, Matcher<?> matcher) { return new HasArgumentWithValue<T, A>(actualArgument(argument), matcher); }
public ManagedMongoDbLifecycleManager getStartedServer(int port) { return selectFirst( this.servers, having(on(ManagedMongoDbLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(true)))); }
/** * Creates an hamcrest matcher that is evalued to true accordingly to the value of the passed argument * @param argument The boolean argument defined using the {@link Lambda#on(Class)} method that has to be matched * @return The hamcrest matcher that is evalued to true accordingly to the value of the passed argument */ public static <T> HasArgumentWithValue<T, Boolean> having(Boolean argument) { return havingValue(argument); }
private SelectiveMatcher findSelectiveMatcherByConnectionIdentifier( SelectiveMatcher[] selectiveMatchers) { return selectFirst( selectiveMatchers, having(on(SelectiveMatcher.class).identifier(), equalTo(identifier)).and( having(on(SelectiveMatcher.class).location(), notNullValue()))); }
/** * Creates an hamcrest matcher that is evalued to true accordingly to the value of the passed argument * @param argument The boolean argument defined using the {@link ch.lambdaj.Lambda#on(Class)} method that has to be matched * @return The hamcrest matcher that is evalued to true accordingly to the value of the passed argument */ @Factory public static <T> HasArgumentWithValue<T, Boolean> havingValue(Boolean argument) { return havingValue(argument, BOOLEAN_MATCHER); }
public ManagedMongoDbLifecycleManager getStoppedServer(int port) { return selectFirst( this.servers, having(on(ManagedMongoDbLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(false)))); }
public ManagedMongoDbLifecycleManager getStoppedServer(int port) { return selectFirst( this.servers, having(on(ManagedMongoDbLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedMongoDbLifecycleManager.class).isReady(), is(false)))); }
private SelectiveMatcher findSelectiveMatcherByConnectionIdentifier( SelectiveMatcher[] selectiveMatchers) { return selectFirst( selectiveMatchers, having(on(SelectiveMatcher.class).identifier(), equalTo(identifier)).and( having(on(SelectiveMatcher.class).location(), notNullValue()))); }
public ManagedRedisLifecycleManager getStoppedServer(int port) { if(this.master.getPort() == port && !this.master.isReady()) { return this.master; } return selectFirst( this.slaveServers, having(on(ManagedRedisLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(false)))); }
public ManagedRedisLifecycleManager getStartedServer(int port) { if(this.master.getPort() == port && this.master.isReady()) { return this.master; } return selectFirst( this.slaveServers, having(on(ManagedRedisLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(true)))); }
public ManagedRedisLifecycleManager getStoppedServer(int port) { if(this.master.getPort() == port && !this.master.isReady()) { return this.master; } return selectFirst( this.slaveServers, having(on(ManagedRedisLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(false)))); }
public ManagedRedisLifecycleManager getStartedServer(int port) { if(this.master.getPort() == port && this.master.isReady()) { return this.master; } return selectFirst( this.slaveServers, having(on(ManagedRedisLifecycleManager.class).getPort(), is(port)).and(having(on(ManagedRedisLifecycleManager.class).isReady(), is(true)))); }