public static class Ensure.ObjectCondition extends Object
| Constructor and Description |
|---|
ObjectCondition(Object value)
Creates a new instance of
ObjectCondition. |
ObjectCondition(Object value,
Object... additionalValues)
Creates a new instance of
ObjectCondition. |
| Modifier and Type | Method and Description |
|---|---|
void |
isInstanceOf(Class<?> type,
Class<?>... additionalTypes)
Ensures that the given object is an instance of one of the specified types.
|
void |
isInstanceOf(Class<?> type,
String explanation,
Object... args)
Ensures that the given object is an instance of the specified type.
|
void |
isNotNull()
Ensures that the given object is not
null. |
void |
isNotNull(String explanation,
Object... args)
Ensures that the given object is not
null. |
void |
isNull()
Ensures that the given object is
null. |
void |
isNull(String explanation,
Object... args)
Ensures that the given object is
null. |
public ObjectCondition(@CheckForNull
Object value)
ObjectCondition.value - value of the conditionpublic void isNotNull()
null.AssertionError - if the object is null@FormatMethod public void isNotNull(String explanation, Object... args)
null.explanation - a formatted message explaining the assertionargs - Arguments referenced by the format specifiers in the formatted explanation. If there are more
arguments than format specifiers, the extra arguments are ignored. The number of arguments is
variable and may be zero.AssertionError - if the object is nullpublic void isNull()
null.AssertionError - if the object is not null@FormatMethod public void isNull(String explanation, Object... args)
null.explanation - a formatted message explaining the assertionargs - Arguments referenced by the format specifiers in the formatted explanation. If there are more
arguments than format specifiers, the extra arguments are ignored. The number of arguments is
variable and may be zero.AssertionError - if the object is not nullpublic void isInstanceOf(Class<?> type, Class<?>... additionalTypes)
type - the type to check the specified object foradditionalTypes - the additional types to check the specified object forAssertionError - the specified object is not an instance of the given type (or null)@FormatMethod public void isInstanceOf(Class<?> type, String explanation, Object... args)
type - the type to check the specified object forexplanation - a formatted message explaining the assertionargs - Arguments referenced by the format specifiers in the formatted explanation. If there are more
arguments than format specifiers, the extra arguments are ignored. The number of arguments is
variable and may be zero.AssertionError - the specified object is not an instance of the given type (or null)Copyright © 2018. All rights reserved.