/** * Await until a Atomic variable has a value matching the specified * {@link org.hamcrest.Matcher}. E.g. * <p> </p> * <pre> * await().untilAtomic(myAtomic, is(greaterThan(2))); * </pre> * * @param atomic the atomic variable * @param matcher the matcher The hamcrest matcher that checks whether the * condition is fulfilled. * @throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period. */ public void untilAtomic(final AtomicBoolean atomic, final Matcher<? super Boolean> matcher) { until(new CallableHamcrestCondition<Boolean>(new Callable<Boolean>() { public Boolean call() { return atomic.get(); } }, matcher, generateConditionSettings())); }
@Override protected String getCallableDescription(final Callable<T> supplier) { final Class<? extends Callable> supplierClass = supplier.getClass(); Method enclosingMethod = supplierClass.getEnclosingMethod(); if (isFieldSupplier(supplierClass)) { return generateFieldSupplierErrorMessage(supplier); } else if (supplierClass.isAnonymousClass() && enclosingMethod != null) { return enclosingMethod.getDeclaringClass().getName() + "." + enclosingMethod.getName() + " Callable"; } else if (isLambdaClass(supplierClass)) { return generateLambdaErrorMessagePrefix(supplierClass, true); } else { return supplierClass.getName(); } }
/** * Await until a Atomic variable has a value matching the specified * {@link org.hamcrest.Matcher}. E.g. * <p> </p> * <pre> * await().untilAtomic(myAtomic, is(greaterThan(2))); * </pre> * * @param atomic the atomic variable * @param matcher the matcher The hamcrest matcher that checks whether the * condition is fulfilled. * @return a {@link java.lang.Integer} object. * @throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period. */ public Integer untilAtomic(final AtomicInteger atomic, final Matcher<? super Integer> matcher) { return until(new CallableHamcrestCondition<Integer>(new Callable<Integer>() { public Integer call() { return atomic.get(); } }, matcher, generateConditionSettings())); }
@Override protected String getCallableDescription(final Callable<T> supplier) { final Class<? extends Callable> supplierClass = supplier.getClass(); Method enclosingMethod = supplierClass.getEnclosingMethod(); if (isFieldSupplier(supplierClass)) { return generateFieldSupplierErrorMessage(supplier); } else if (supplierClass.isAnonymousClass() && enclosingMethod != null) { return enclosingMethod.getDeclaringClass().getName() + "." + enclosingMethod.getName() + " Callable"; } else if (isLambdaClass(supplierClass)) { return generateLambdaErrorMessagePrefix(supplierClass, true); } else { return supplierClass.getName(); } }
/** * Await until a Atomic variable has a value matching the specified * {@link org.hamcrest.Matcher}. E.g. * <p> </p> * <pre> * await().untilAtomic(myAtomic, is(greaterThan(2))); * </pre> * * @param atomic the atomic variable * @param matcher the matcher The hamcrest matcher that checks whether the * condition is fulfilled. * @return a {@link java.lang.Long} object. * @throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period. */ public Long untilAtomic(final AtomicLong atomic, final Matcher<? super Long> matcher) { return until(new CallableHamcrestCondition<Long>(new Callable<Long>() { public Long call() { return atomic.get(); } }, matcher, generateConditionSettings())); }
/** * Await until a Atomic variable has a value matching the specified * {@link org.hamcrest.Matcher}. E.g. * <p> </p> * <pre> * await().untilAtomic(myAtomic, is(greaterThan(2))); * </pre> * * @param atomic the atomic variable * @param matcher the matcher The hamcrest matcher that checks whether the * condition is fulfilled. * @param <V> a V object. * @return a V object. * @throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period. */ public <V> V untilAtomic(final AtomicReference<V> atomic, final Matcher<? super V> matcher) { return until(new CallableHamcrestCondition<V>(new Callable<V>() { public V call() { return atomic.get(); } }, matcher, generateConditionSettings())); }
return until(new CallableHamcrestCondition<T>(supplier, matcher, generateConditionSettings()));
/** * Await until a Atomic variable has a value matching the specified * {@link org.hamcrest.Matcher}. E.g. * <p> </p> * <pre> * await().untilAtomic(myAtomic, is(greaterThan(2))); * </pre> * * @param atomic the atomic variable * @param matcher the matcher The hamcrest matcher that checks whether the * condition is fulfilled. * @throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period. */ public void untilAtomic(final AtomicBoolean atomic, final Matcher<? super Boolean> matcher) { until(new CallableHamcrestCondition<Boolean>(new Callable<Boolean>() { public Boolean call() { return atomic.get(); } }, matcher, generateConditionSettings())); }
/** * Await until a Atomic variable has a value matching the specified * {@link org.hamcrest.Matcher}. E.g. * <p> </p> * <pre> * await().untilAtomic(myAtomic, is(greaterThan(2))); * </pre> * * @param atomic the atomic variable * @param matcher the matcher The hamcrest matcher that checks whether the * condition is fulfilled. * @return a {@link java.lang.Integer} object. * @throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period. */ public Integer untilAtomic(final AtomicInteger atomic, final Matcher<? super Integer> matcher) { return until(new CallableHamcrestCondition<Integer>(new Callable<Integer>() { public Integer call() { return atomic.get(); } }, matcher, generateConditionSettings())); }
/** * Await until a Atomic variable has a value matching the specified * {@link org.hamcrest.Matcher}. E.g. * <p> </p> * <pre> * await().untilAtomic(myAtomic, is(greaterThan(2))); * </pre> * * @param atomic the atomic variable * @param matcher the matcher The hamcrest matcher that checks whether the * condition is fulfilled. * @return a {@link java.lang.Long} object. * @throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period. */ public Long untilAtomic(final AtomicLong atomic, final Matcher<? super Long> matcher) { return until(new CallableHamcrestCondition<Long>(new Callable<Long>() { public Long call() { return atomic.get(); } }, matcher, generateConditionSettings())); }
/** * Await until a Atomic variable has a value matching the specified * {@link org.hamcrest.Matcher}. E.g. * <p> </p> * <pre> * await().untilAtomic(myAtomic, is(greaterThan(2))); * </pre> * * @param atomic the atomic variable * @param matcher the matcher The hamcrest matcher that checks whether the * condition is fulfilled. * @param <V> a V object. * @return a V object. * @throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period. */ public <V> V untilAtomic(final AtomicReference<V> atomic, final Matcher<? super V> matcher) { return until(new CallableHamcrestCondition<V>(new Callable<V>() { public V call() { return atomic.get(); } }, matcher, generateConditionSettings())); }
return until(new CallableHamcrestCondition<T>(supplier, matcher, generateConditionSettings()));