From 9d70c0a8a6dd8f7cc7aa089ce9987dc84afeeaf0 Mon Sep 17 00:00:00 2001 From: TheMode Date: Tue, 8 Feb 2022 01:54:36 +0100 Subject: [PATCH] Add Collector#assertEmpty Signed-off-by: TheMode --- src/test/java/net/minestom/server/api/Collector.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/net/minestom/server/api/Collector.java b/src/test/java/net/minestom/server/api/Collector.java index 20de16bae..002b71dbf 100644 --- a/src/test/java/net/minestom/server/api/Collector.java +++ b/src/test/java/net/minestom/server/api/Collector.java @@ -11,6 +11,11 @@ import static org.junit.jupiter.api.Assertions.assertInstanceOf; public interface Collector { @NotNull List<@NotNull T> collect(); + default void assertEmpty() { + List elements = collect(); + assertEquals(0, elements.size(), "Expected 0 element, got " + elements); + } + default

void assertSingle(@NotNull Class

type, @NotNull Consumer

consumer) { List elements = collect(); assertEquals(1, elements.size(), "Expected 1 element, got " + elements);