T - the type of statements to capturepublic class StatementCaptureList<T extends GenericStatement> extends Object
StatementCaptureList class defines a class capable of
capturing executing statements.| Modifier and Type | Method and Description |
|---|---|
StatementCaptureList<T> |
andExpect(org.hamcrest.Matcher<StatementCaptureList<T>> matcher)
Provides an expectation for the statement capture list.
|
StatementCaptureList<T> |
andExpect(StatementCaptureListMatcher<T> matcher)
Provides an expectation for the statement capture list.
|
StatementCaptureList<T> |
dump(Logger logger,
Level level)
Dumps the content of the capture list.
|
StatementCaptureList<T> |
fail(int num,
RuntimeException e)
Registers an interceptor to intercept the next
num executing
statements to throw back the specified error. |
StatementCaptureList<T> |
fail(RuntimeException e)
Registers an interceptor to intercept all executing statement to throw back
the specified error.
|
StatementCaptureList<T> |
intercept(java.util.function.Consumer<T> consumer)
Registers a consumer to intercept all executing statement.
|
StatementCaptureList<T> |
intercept(int num,
java.util.function.Consumer<T> consumer)
Registers a consumer to intercept the next
num executing
statements. |
boolean |
isEmpty()
Checks if this list did not capture any statements.
|
T |
on(int i)
Gets the ith captured statement if available.
|
int |
size()
Gets the number of statements captured.
|
StatementCaptureList<T> |
stop()
Stops capturing and intercepting statements with this capture list.
|
StatementCaptureList<T> |
stopIntercepting()
Stops all registered interceptors.
|
public StatementCaptureList<T> stop()
public StatementCaptureList<T> dump(Logger logger, Level level)
logger - the logger where to dump the content of this capture listlevel - the log level to use when dumpingpublic int size()
public boolean isEmpty()
true if this list did not capture any statements;
false otherwisepublic StatementCaptureList<T> intercept(java.util.function.Consumer<T> consumer)
consumer - the consumer to call in order to intercept all statementsNullPointerException - if consumer is nullpublic StatementCaptureList<T> intercept(int num, java.util.function.Consumer<T> consumer)
num executing
statements. An interceptor gets called just before the statement is submitted
to Cassandra. Upon returning control from the interceptor, the statement
will be submitted to Cassandra unless an exception was thrown out.num - the number of times this interceptor should remain activeconsumer - the consumer to call in order to intercept the next statementsNullPointerException - if consumer is nullpublic StatementCaptureList<T> fail(RuntimeException e)
Note: The same exception is throw back each time a statement is intercepted and will have its stack trace re-filled every time.
e - the error to throw back when intercepting all statementsNullPointerException - if e is nullpublic StatementCaptureList<T> fail(int num, RuntimeException e)
num executing
statements to throw back the specified error. An interceptor gets called
just before the statement is submitted to Cassandra.
Note: The same exception is throw back each time a statement is intercepted and will have its stack trace re-filled every time.
num - the number of times this interceptor should remain activee - the error to throw back when intercepting the next statementsNullPointerException - if e is nullpublic StatementCaptureList<T> stopIntercepting()
public T on(int i)
i - the captured statements (0-based)null statementAssertionError - if less statements were capturedpublic StatementCaptureList<T> andExpect(StatementCaptureListMatcher<T> matcher) throws Exception
matcher - the statement capture list matcher to useException - if an error occurspublic StatementCaptureList<T> andExpect(org.hamcrest.Matcher<StatementCaptureList<T>> matcher) throws Exception
matcher - the statement capture list matcher to useException - if an error occursCopyright (C) 2015-2017 The Helenus Driver Project Authors.