Commit 2bd335f6 authored by Florian Schäfer's avatar Florian Schäfer

Replace usage of JUnit Jupiter with polyfill until Ant build updates to JUnit 5

parent f49820df
......@@ -9,7 +9,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.wikipedia.testutils.JunitJupiterCompatUtil.assertThrows;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.github.tomakehurst.wiremock.matching.EqualToPattern;
......
package org.wikipedia.testutils;
import static org.junit.Assert.assertTrue;
public class JunitJupiterCompatUtil {
public static <T extends Throwable> void assertThrows(Class<T> expectedType, Runnable runnable) {
boolean success = false;
Throwable throwable = null;
try {
runnable.run();
} catch (Throwable t) {
success = expectedType.isInstance(t);
throwable = t;
}
assertTrue("Expected " + expectedType.getName() + " but was " + (throwable == null ? "null" : throwable.getClass().getName()), success);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment