public class PrototypeObjectExpectation<T> extends Object
| Constructor and Description |
|---|
PrototypeObjectExpectation(Prototype<?> prototype,
PrototypeProperty property) |
| Modifier and Type | Method and Description |
|---|---|
void |
hasExpectation(PropertyExpectation<T> expectation)
Set an expectation that the object should not be null.
|
void |
isEqualTo(T expectedValue)
Set an expectation that the property value is equal to another object using the objects equals method.
|
void |
isInstanceOf(Class<? extends T> expectedValue)
Set an expectation that the property value is an instance of a type.
|
void |
isNotEqualTo(T expectedValue)
Set an expectation that the property value is not equal to another object using the objects equals method.
|
void |
isNotNull()
Set an expectation that the object should not be null.
|
void |
isNull()
Set an expectation that the object should be null.
|
void |
isOneOf(Collection<T> possibleValues)
Set an expectation that the property value is equal to one of the expected object using the object's equals method.
|
void |
isOneOf(T... possibleValues)
Set an expectation that the property value is equal to one of the expected object using the object's equals method.
|
void |
matches(org.hamcrest.Matcher<T> matcher)
Set an expectation that the property value matches a hamcrest matcher.
|
public PrototypeObjectExpectation(Prototype<?> prototype, PrototypeProperty property)
public void matches(org.hamcrest.Matcher<T> matcher)
MyObject expected = prototype(MyObject.class);
expect(expected.name()).matches(Matchers.equalTo("Jane"));
expectThat(actual).matches(expected);
matcher - the hamcrest matcher to use to match the itempublic void isEqualTo(T expectedValue)
MyObject expected = prototype(MyObject.class);
expect(expected.name()).isEqualTo("Jane");
expectThat(actual).matches(expected);
expectedValue - the value this property should be equal topublic void isNotEqualTo(T expectedValue)
MyObject expected = prototype(MyObject.class);
expect(expected.name()).isNotEqualTo("Jane");
expectThat(actual).matches(expected);
expectedValue - the value this property should not be equal topublic void isOneOf(T... possibleValues)
MyObject expected = prototype(MyObject.class);
expect(expected.name()).isOneOf("Jane", "Bob");
expectThat(actual).matches(expected);
possibleValues - the range of possible value this property should be one ofpublic void isOneOf(Collection<T> possibleValues)
List<String> options = Arrays.asList("Jane", "Bob");
MyObject expected = prototype(MyObject.class);
expect(expected.name()).isOneOf(options);
expectThat(actual).matches(expected);
possibleValues - the range of possible value this property should be one ofpublic void isInstanceOf(Class<? extends T> expectedValue)
MyObject expected = prototype(MyObject.class); expect(expected.name()).isInstanceOf(String.class); expectThat(actual).matches(expected);
expectedValue - the type this property should be an instance ofpublic void isNull()
MyObject expected = prototype(MyObject.class); expect(expected.name()).isNull(); expectThat(actual).matches(expected);
public void isNotNull()
MyObject expected = prototype(MyObject.class); expect(expected.name()).isNotNull(); expectThat(actual).matches(expected);
public void hasExpectation(PropertyExpectation<T> expectation)
MyObject expected = prototype(MyObject.class); expect(expected.name()).isNotNull(); expectThat(actual).matches(expected);
Copyright © 2015. All rights reserved.