public class EntityAsserts
extends java.lang.Object
Constructor and Description |
---|
EntityAsserts() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
assertAttribute(Entity entity,
AttributeSensor<T> attribute,
<any> predicate) |
static void |
assertAttributeChangesEventually(Entity entity,
AttributeSensor<?> attribute)
Asserts that the entity's value for this attribute changes, by registering a subscription and checking the value.
|
static <T> void |
assertAttributeContinuallyNotEqualTo(Entity entity,
AttributeSensor<T> attribute,
T... disallowed)
Assert that the given attribute of an entity does not take any of the disallowed values during a given period.
|
static <T> void |
assertAttributeContinuallyNotEqualTo(java.util.Map<?,?> flags,
Entity entity,
AttributeSensor<T> attribute,
T... disallowed)
Assert that the given attribute of an entity does not take any of the disallowed values during a given period.
|
static <T> void |
assertAttributeEquals(Entity entity,
AttributeSensor<T> attribute,
T expected) |
static <T> void |
assertAttributeEqualsContinually(Entity entity,
AttributeSensor<T> attribute,
T expected) |
static <T> void |
assertAttributeEqualsContinually(java.util.Map<?,?> flags,
Entity entity,
AttributeSensor<T> attribute,
T expected) |
static <T> void |
assertAttributeEqualsEventually(Entity entity,
AttributeSensor<T> attribute,
T expected) |
static <T> void |
assertAttributeEqualsEventually(java.util.Map<?,?> flags,
Entity entity,
AttributeSensor<T> attribute,
T expected) |
static <T> T |
assertAttributeEventually(Entity entity,
AttributeSensor<T> attribute,
<any> predicate) |
static <T> T |
assertAttributeEventually(java.util.Map<?,?> flags,
Entity entity,
AttributeSensor<T> attribute,
<any> predicate) |
static <T> T |
assertAttributeEventuallyNonNull(Entity entity,
AttributeSensor<T> attribute) |
static <T> T |
assertAttributeEventuallyNonNull(java.util.Map<?,?> flags,
Entity entity,
AttributeSensor<T> attribute) |
static <T> void |
assertConfigEquals(Entity entity,
ConfigKey<T> configKey,
T expected) |
static void |
assertEntityFailed(Entity entity)
Asserts sensors
service.isUp is false, and that service.state is "on fire". |
static void |
assertEntityHealthy(Entity entity)
Asserts sensors
service.isUp is true, and that service.state is "running". |
static void |
assertEntityHealthyEventually(Entity entity) |
static void |
assertGroupSizeEqualsEventually(Group group,
int expected) |
static void |
assertGroupSizeEqualsEventually(java.util.Map<?,?> flags,
Group group,
int expected) |
static <T extends Entity> |
assertPredicateEventuallyTrue(java.util.Map<?,?> flags,
T entity,
<any> predicate) |
static <T extends Entity> |
assertPredicateEventuallyTrue(T entity,
<any> predicate) |
public static <T> void assertAttributeEquals(Entity entity, AttributeSensor<T> attribute, T expected)
public static <T> void assertConfigEquals(Entity entity, ConfigKey<T> configKey, T expected)
public static <T> void assertAttributeEqualsEventually(Entity entity, AttributeSensor<T> attribute, T expected)
public static <T> void assertAttributeEqualsEventually(java.util.Map<?,?> flags, Entity entity, AttributeSensor<T> attribute, T expected)
public static <T> T assertAttributeEventuallyNonNull(Entity entity, AttributeSensor<T> attribute)
public static <T> T assertAttributeEventuallyNonNull(java.util.Map<?,?> flags, Entity entity, AttributeSensor<T> attribute)
public static <T> T assertAttributeEventually(Entity entity, AttributeSensor<T> attribute, <any> predicate)
public static <T> T assertAttributeEventually(java.util.Map<?,?> flags, Entity entity, AttributeSensor<T> attribute, <any> predicate)
public static <T> T assertAttribute(Entity entity, AttributeSensor<T> attribute, <any> predicate)
public static <T extends Entity> void assertPredicateEventuallyTrue(T entity, <any> predicate)
public static <T extends Entity> void assertPredicateEventuallyTrue(java.util.Map<?,?> flags, T entity, <any> predicate)
public static <T> void assertAttributeEqualsContinually(Entity entity, AttributeSensor<T> attribute, T expected)
public static <T> void assertAttributeEqualsContinually(java.util.Map<?,?> flags, Entity entity, AttributeSensor<T> attribute, T expected)
public static void assertGroupSizeEqualsEventually(Group group, int expected)
public static void assertGroupSizeEqualsEventually(java.util.Map<?,?> flags, Group group, int expected)
public static void assertAttributeChangesEventually(Entity entity, AttributeSensor<?> attribute)
entity
- The entity whose attribute will be checked.attribute
- The attribute to check on the entity.java.lang.AssertionError
- if the assertion fails.@SafeVarargs public static <T> void assertAttributeContinuallyNotEqualTo(Entity entity, AttributeSensor<T> attribute, T... disallowed)
Asserts.succeedsContinually(Runnable)
, therefore it loops comparing the value
of the attribute to the disallowed values, rather than setting up a subscription. It may therefore miss a
situation where the attribute temporarily takes a disallowed value. This method is therefore suited for use
where the attribute will take on a value permanently, which may or may not be disallowed.T
- Type of the sensor.entity
- The entity owning the attribute to check.attribute
- The attribute on the entity.disallowed
- The disallowed values for the entity.@SafeVarargs public static <T> void assertAttributeContinuallyNotEqualTo(java.util.Map<?,?> flags, Entity entity, AttributeSensor<T> attribute, T... disallowed)
Asserts.succeedsContinually(Runnable)
, therefore it loops comparing the value
of the attribute to the disallowed values, rather than setting up a subscription. It may therefore miss a
situation where the attribute temporarily takes a disallowed value. This method is therefore suited for use
where the attribute will take on a value permanently, which may or may not be disallowed.T
- Type of the sensor.flags
- Flags controlling the loop, with keys: entity
- The entity owning the attribute to check.attribute
- The attribute on the entity.disallowed
- The disallowed values for the entity.public static void assertEntityHealthy(Entity entity)
service.isUp
is true, and that service.state
is "running".
Setting these sensors is common behaviour for entities, but depends on the particular entity
implementation.public static void assertEntityHealthyEventually(Entity entity)
public static void assertEntityFailed(Entity entity)
service.isUp
is false, and that service.state
is "on fire".
Setting these sensors is common behaviour for entities, but depends on the particular entity
implementation.