public abstract class AbstractWhenThen<T extends TestExpectation> extends java.lang.Object implements WhenThen<T>
Constructor and Description |
---|
AbstractWhenThen(UserIdentifier producerIdentifier,
UserIdentifier userIdentifier,
Authorization authorizationRule,
UserRoleIT userRoleIT) |
Modifier and Type | Method and Description |
---|---|
WhenThen<T> |
byDefault(T testExpectation)
Define default expectation.
|
WhenThen<T> |
debugRoleMappings(java.util.function.Consumer<java.lang.String> logger)
Prints role mappings using the given consumer to print them
|
protected abstract T |
getDefaultExpectation(ConsumerProducerSet consumerProducerSet) |
WhenThen<T> |
otherwise(T testExpectation)
Define default expectation.
|
void |
test()
Execute the call under test and run assertions
|
protected abstract void |
test(T testExpectation,
ConsumerProducerSet consumerProducerSet) |
WhenThen<T> |
then(T testExpectation)
Make sure to call
When.whenCalledWithAnyOf(fi.vincit.multiusertest.util.UserIdentifierCollection...) or When.whenCalledWithAnyOf(UserIdentifier...)
first to set the user identifiers this call will add the expectation. |
ThenProducer<T> |
whenCalledWithAnyOf(java.util.Collection<UserIdentifier> userIdentifiers)
Sets the active consumers for assertions.
|
ThenProducer<T> |
whenCalledWithAnyOf(java.util.function.Supplier<java.util.Collection<UserIdentifier>> userIdentifierSupplier)
Sets the active consumers for assertions.
|
ThenProducer<T> |
whenCalledWithAnyOf(UserIdentifier... userIdentifiers)
Sets the active consumers for assertions.
|
ThenProducer<T> |
whenCalledWithAnyOf(UserIdentifierCollection... userIdentifiers)
Sets the active consumers for assertions.
|
When<T> |
whenProducerIsAny()
Sets the active producer to be any.
|
When<T> |
whenProducerIsAnyOf(java.util.Collection<UserIdentifier> producerIdentifiers)
Sets the active producers for assertions.
|
When<T> |
whenProducerIsAnyOf(java.util.function.Supplier<java.util.Collection<UserIdentifier>> producerIdentifierSupplier)
Sets the active producers for assertions.
|
When<T> |
whenProducerIsAnyOf(UserIdentifier... producerIdentifiers)
Sets the active producers for assertions.
|
When<T> |
whenProducerIsAnyOf(UserIdentifierCollection... producerIdentifiers)
Sets the active producers for assertions.
|
public AbstractWhenThen(UserIdentifier producerIdentifier, UserIdentifier userIdentifier, Authorization authorizationRule, UserRoleIT userRoleIT)
public ThenProducer<T> whenCalledWithAnyOf(UserIdentifierCollection... userIdentifiers)
When
UserIdentifiers
.whenCalledWithAnyOf
in interface When<T extends TestExpectation>
userIdentifiers
- User identifier collectionspublic ThenProducer<T> whenCalledWithAnyOf(UserIdentifier... userIdentifiers)
When
UserIdentifier
objects.
In most cases When.whenCalledWithAnyOf(UserIdentifierCollection...)
is preferred since it works well
with UserIdentifiers
helper methods.whenCalledWithAnyOf
in interface When<T extends TestExpectation>
userIdentifiers
- User identifierspublic ThenProducer<T> whenCalledWithAnyOf(java.util.Collection<UserIdentifier> userIdentifiers)
When
UserIdentifier
objects.whenCalledWithAnyOf
in interface When<T extends TestExpectation>
userIdentifiers
- Collection of user identifierspublic ThenProducer<T> whenCalledWithAnyOf(java.util.function.Supplier<java.util.Collection<UserIdentifier>> userIdentifierSupplier)
When
whenCalledWithAnyOf
in interface When<T extends TestExpectation>
userIdentifierSupplier
- Supplier methodpublic When<T> whenProducerIsAny()
WhenProducer
whenProducerIsAny
in interface WhenProducer<T extends TestExpectation>
public When<T> whenProducerIsAnyOf(UserIdentifierCollection... producerIdentifiers)
WhenProducer
UserIdentifiers
.
Calling this will clear active consumer identifiers.whenProducerIsAnyOf
in interface WhenProducer<T extends TestExpectation>
producerIdentifiers
- Producer identifier collectionspublic When<T> whenProducerIsAnyOf(UserIdentifier... producerIdentifiers)
WhenProducer
UserIdentifier
objects.
In most cases WhenProducer.whenProducerIsAnyOf(UserIdentifierCollection...)
is preferred since it works
well with UserIdentifiers
helper methods.
Calling this will clear active consumer identifiers.whenProducerIsAnyOf
in interface WhenProducer<T extends TestExpectation>
producerIdentifiers
- User identifierspublic When<T> whenProducerIsAnyOf(java.util.Collection<UserIdentifier> producerIdentifiers)
WhenProducer
UserIdentifier
objects.
Calling this will clear active consumer identifiers.whenProducerIsAnyOf
in interface WhenProducer<T extends TestExpectation>
producerIdentifiers
- Collection of user identifierspublic When<T> whenProducerIsAnyOf(java.util.function.Supplier<java.util.Collection<UserIdentifier>> producerIdentifierSupplier)
WhenProducer
whenProducerIsAnyOf
in interface WhenProducer<T extends TestExpectation>
producerIdentifierSupplier
- Supplier methodpublic WhenThen<T> then(T testExpectation)
Then
When.whenCalledWithAnyOf(fi.vincit.multiusertest.util.UserIdentifierCollection...)
or When.whenCalledWithAnyOf(UserIdentifier...)
first to set the user identifiers this call will add the expectation.then
in interface Then<T extends TestExpectation>
testExpectation
- Expectation to test for the previous when identifierspublic WhenThen<T> otherwise(T testExpectation)
Then
otherwise
in interface Then<T extends TestExpectation>
testExpectation
- Default expectationpublic WhenThen<T> byDefault(T testExpectation)
Then
Then.otherwise(TestExpectation)
.byDefault
in interface Then<T extends TestExpectation>
testExpectation
- Default expectationpublic WhenThen<T> debugRoleMappings(java.util.function.Consumer<java.lang.String> logger)
WhenThen
debugRoleMappings
in interface WhenThen<T extends TestExpectation>
logger
- Logger printerpublic void test() throws java.lang.Throwable
WhenThen
test
in interface WhenThen<T extends TestExpectation>
java.lang.Throwable
- If an exception is thrown during the testprotected abstract void test(T testExpectation, ConsumerProducerSet consumerProducerSet) throws java.lang.Throwable
java.lang.Throwable
protected abstract T getDefaultExpectation(ConsumerProducerSet consumerProducerSet)