mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-25 02:27:38 +01:00
Add Collector#assertEmpty
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
b26abc11b0
commit
9d70c0a8a6
@ -11,6 +11,11 @@ import static org.junit.jupiter.api.Assertions.assertInstanceOf;
|
||||
public interface Collector<T> {
|
||||
@NotNull List<@NotNull T> collect();
|
||||
|
||||
default void assertEmpty() {
|
||||
List<T> elements = collect();
|
||||
assertEquals(0, elements.size(), "Expected 0 element, got " + elements);
|
||||
}
|
||||
|
||||
default <P extends T> void assertSingle(@NotNull Class<P> type, @NotNull Consumer<P> consumer) {
|
||||
List<T> elements = collect();
|
||||
assertEquals(1, elements.size(), "Expected 1 element, got " + elements);
|
||||
|
Loading…
Reference in New Issue
Block a user