public class PrototypeCollectionExpectation<E,T extends Collection<E>> extends PrototypeObjectExpectation<T>
| Constructor and Description |
|---|
PrototypeCollectionExpectation(Prototype<?> prototype,
PrototypeProperty property) |
| Modifier and Type | Method and Description |
|---|---|
void |
contains(E element)
Set an expectation that the collection contains an item.
|
void |
containsExpected(E element)
Set an expectation that the collection contains an item which matches the expectation.
|
void |
hasSize(int size)
Set an expectation that the collection is of the given size.
|
void |
isEmpty()
Set an expectation that the collection is empty.
|
void |
isNotEmpty()
Set an expectation that the collection is not empty.
|
hasExpectation, isEqualTo, isInstanceOf, isNotEqualTo, isNotNull, isNull, isOneOf, isOneOf, matchespublic PrototypeCollectionExpectation(Prototype<?> prototype, PrototypeProperty property)
public void isEmpty()
MyObject expected = prototype(MyObject.class); expect(expected.myCollection()).isEmpty(); expectThat(actual).matches(expected);
public void isNotEmpty()
MyObject expected = prototype(MyObject.class); expect(expected.myCollection()).isNotEmpty(); expectThat(actual).matches(expected);
public void hasSize(int size)
MyObject expected = prototype(MyObject.class); expect(expected.myCollection()).hasSize(1); expectThat(actual).matches(expected);
size - the expected size of the collectionpublic void contains(E element)
MyObject expected = prototype(MyObject.class);
expect(expected.myCollection()).contains("ABCD");
expectThat(actual).matches(expected);
element - the item to find in the collectionpublic void containsExpected(E element)
MyChild child = prototype(MyChild.class);
expect(child.getName()).isEqualTo("Bob");
MyObject expected = prototype(MyObject.class);
expect(expected.myCollection()).containsExpected(child);
expectThat(actual).matches(expected);
element - the expectation to find in the collectionCopyright © 2015. All rights reserved.