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) Futures
futures
-
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, assertionErrorCreator, conditions, info, myself, objects, throwUnsupportedExceptionOnEquals
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractFutureAssert(ACTUAL actual, Class<?> selfType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SELF
isCancelled()
Verifies that theFuture
is cancelled.SELF
isDone()
Verifies that theFuture
is done.SELF
isNotCancelled()
Verifies that theFuture
is not cancelled.SELF
isNotDone()
Verifies that theFuture
is 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 theFuture
is 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 theFuture
is 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 theFuture
is 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 theFuture
is 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()
-
-