Package org.assertj.core.api
Class AbstractFutureAssert<SELF extends AbstractFutureAssert<SELF,ACTUAL,RESULT>,ACTUAL extends Future<RESULT>,RESULT>
- java.lang.Object
-
- org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
-
- org.assertj.core.api.AbstractFutureAssert<SELF,ACTUAL,RESULT>
-
- All Implemented Interfaces:
Assert<SELF,ACTUAL>,Descriptable<SELF>,ExtensionPoints<SELF,ACTUAL>
- Direct Known Subclasses:
FutureAssert
public abstract class AbstractFutureAssert<SELF extends AbstractFutureAssert<SELF,ACTUAL,RESULT>,ACTUAL extends Future<RESULT>,RESULT> extends AbstractAssert<SELF,ACTUAL>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Futuresfutures-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, assertionErrorCreator, conditions, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFutureAssert(ACTUAL actual, Class<?> selfType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SELFisCancelled()Verifies that theFutureis cancelled.SELFisDone()Verifies that theFutureis done.SELFisNotCancelled()Verifies that theFutureis not cancelled.SELFisNotDone()Verifies that theFutureis not done.-
Methods inherited from class org.assertj.core.api.AbstractAssert
as, as, asInstanceOf, asList, asString, describedAs, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withAssertionState, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Field Detail
-
futures
Futures futures
-
-
Method Detail
-
isCancelled
public SELF isCancelled()
Verifies that theFutureis cancelled.Example:
ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<String> future = executorService.submit(new Callable<String>() { @Override public String call() throws Exception { return "done"; } }); // assertion will fail: assertThat(future).isCancelled(); // assertion will pass: future.cancel(true); assertThat(future).isCancelled();- Returns:
- this assertion object.
- Since:
- 2.7.0 / 3.7.0
- See Also:
Future.isCancelled()
-
isNotCancelled
public SELF isNotCancelled()
Verifies that theFutureis not cancelled.Example:
ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<String> future = executorService.submit(new Callable<String>() { @Override public String call() throws Exception { return "done"; } }); // assertion will pass: assertThat(future).isNotCancelled(); // assertion will fail: future.cancel(true); assertThat(future).isNotCancelled();- Returns:
- this assertion object.
- Since:
- 2.7.0 / 3.7.0
- See Also:
Future.isCancelled()
-
isDone
public SELF isDone()
Verifies that theFutureis done.Example:
ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<String> future = executorService.submit(new Callable<String>() { @Override public String call() throws Exception { return "done"; } }); // assertion will pass: assertThat(future).isDone(); future = executorService.submit(new Callable<String>() { @Override public String call() throws Exception { Thread.sleep(1000); return "done"; } }); // assertion will fail: assertThat(future).isDone();- Returns:
- this assertion object.
- Since:
- 2.7.0 / 3.7.0
- See Also:
Future.isDone()
-
isNotDone
public SELF isNotDone()
Verifies that theFutureis not done.Example:
ExecutorService executorService = Executors.newSingleThreadExecutor(); Future<String> future = executorService.submit(new Callable<String>() { @Override public String call() throws Exception { Thread.sleep(1000); return "done"; } }); // assertion will pass: assertThat(future).isNotDone(); future = executorService.submit(new Callable<String>() { @Override public String call() throws Exception { return "done"; } }); // assertion will fail: assertThat(future).isNotDone();- Returns:
- this assertion object.
- Since:
- 2.7.0 / 3.7.0
- See Also:
Future.isDone()
-
-