CommonCore/testsrc/de/steamwar/AssertionUtils.java
2022-04-22 12:19:43 +02:00

27 Zeilen
831 B
Java

package de.steamwar;
import de.steamwar.command.CommandFrameworkException;
import lombok.experimental.UtilityClass;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
@UtilityClass
public class AssertionUtils {
public static void assertCMDFramework(Exception e, Class<?> clazz, String message) {
assertThat(e, is(instanceOf(CommandFrameworkException.class)));
assertThat(e.getCause().getCause(), is(instanceOf(clazz)));
assertThat(e.getCause().getCause().getMessage(), is(message));
}
public static <T> void assertTabCompletes(List<T> list, T... elements) {
assertThat(list.size(), is(elements.length));
if (elements.length > 0) {
assertThat(list, containsInAnyOrder(elements));
}
}
}