|
4 | 4 | import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; |
5 | 5 | import com.github.tomakehurst.wiremock.extension.responsetemplating.helpers.HandlebarsCurrentDateHelper; |
6 | 6 | import org.apache.commons.io.IOUtils; |
7 | | -import org.hamcrest.Description; |
8 | 7 | import org.hamcrest.Matcher; |
| 8 | +import org.hamcrest.MatcherAssert; |
9 | 9 | import org.hamcrest.Matchers; |
10 | | -import org.hamcrest.StringDescription; |
11 | 10 | import org.junit.After; |
12 | 11 | import org.junit.Assert; |
13 | 12 | import org.junit.Before; |
|
21 | 20 | import java.io.IOException; |
22 | 21 | import java.util.*; |
23 | 22 |
|
| 23 | +import static org.hamcrest.Matchers.*; |
24 | 24 | import static org.junit.Assume.assumeFalse; |
25 | 25 | import static org.junit.Assume.assumeTrue; |
26 | 26 |
|
27 | 27 | /** |
28 | 28 | * @author Liam Newman |
29 | 29 | */ |
30 | | -public abstract class AbstractGitHubWireMockTest extends Assert { |
| 30 | +public abstract class AbstractGitHubWireMockTest { |
31 | 31 |
|
32 | 32 | private final GitHubBuilder githubBuilder = createGitHubBuilder(); |
33 | 33 |
|
@@ -255,52 +255,23 @@ private String getOrganization() throws IOException { |
255 | 255 | return mockGitHub.isTestWithOrg() ? GITHUB_API_TEST_ORG : gitHub.getMyself().getLogin(); |
256 | 256 | } |
257 | 257 |
|
258 | | - public static <T> void assertThat(T actual, Matcher<? super T> matcher) { |
259 | | - assertThat("", actual, matcher); |
| 258 | + public static void fail() { |
| 259 | + Assert.fail(); |
260 | 260 | } |
261 | | - |
262 | | - public static <T> void assertThat(String reason, T actual, Matcher<? super T> matcher) { |
263 | | - if (!matcher.matches(actual)) { |
264 | | - Description description = new StringDescription(); |
265 | | - description.appendText(reason) |
266 | | - .appendText(System.lineSeparator()) |
267 | | - .appendText("Expected: ") |
268 | | - .appendDescriptionOf(matcher) |
269 | | - .appendText(System.lineSeparator()) |
270 | | - .appendText(" but: "); |
271 | | - matcher.describeMismatch(actual, description); |
272 | | - throw new AssertionError(description.toString()); |
273 | | - } |
| 261 | + public static void fail(String reason) { |
| 262 | + Assert.fail(reason); |
274 | 263 | } |
275 | 264 |
|
276 | | - public static void assertThat(String reason, boolean assertion) { |
277 | | - if (!assertion) { |
278 | | - throw new AssertionError(reason); |
279 | | - } |
280 | | - } |
281 | | - |
282 | | - public static void assertEquals(Object expected, Object actual) { |
283 | | - assertThat(actual, Matchers.equalTo(expected)); |
284 | | - } |
285 | | - |
286 | | - public static void assertNotEquals(Object expected, Object actual) { |
287 | | - assertThat(actual, Matchers.not(expected)); |
288 | | - } |
289 | | - |
290 | | - public static void assertNotNull(Object actual) { |
291 | | - assertThat(actual, Matchers.notNullValue()); |
292 | | - } |
293 | | - |
294 | | - public static void assertNull(Object actual) { |
295 | | - assertThat(actual, Matchers.nullValue()); |
| 265 | + public static <T> void assertThat(T actual, Matcher<? super T> matcher) { |
| 266 | + MatcherAssert.assertThat("", actual, matcher); |
296 | 267 | } |
297 | 268 |
|
298 | | - public static void assertTrue(Boolean condition) { |
299 | | - assertThat(condition, Matchers.is(true)); |
| 269 | + public static <T> void assertThat(String reason, T actual, Matcher<? super T> matcher) { |
| 270 | + MatcherAssert.assertThat(reason, actual, matcher); |
300 | 271 | } |
301 | 272 |
|
302 | | - public static void assertFalse(Boolean condition) { |
303 | | - assertThat(condition, Matchers.is(false)); |
| 273 | + public static void assertThat(String reason, boolean assertion) { |
| 274 | + MatcherAssert.assertThat(reason, assertion); |
304 | 275 | } |
305 | 276 |
|
306 | 277 | protected static class TemplatingHelper { |
|
0 commit comments