Skip to content

Commit

Permalink
Merge pull request #693 from alexanderrtaylor/replaceAsserts
Browse files Browse the repository at this point in the history
Replacing asserts with standard
  • Loading branch information
bitwiseman authored Feb 3, 2020
2 parents 001f8f1 + 134a6fa commit 32e5c5b
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.commons.io.IOUtils;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.hamcrest.StringDescription;
import org.junit.After;
import org.junit.Assert;
Expand All @@ -16,7 +17,6 @@
import java.io.IOException;
import java.util.*;

import static org.hamcrest.Matchers.is;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;

Expand Down Expand Up @@ -130,7 +130,7 @@ protected void verifyAuthenticated(GitHub instance) {
assertThat(
"GitHub connection believes it is anonymous. Make sure you set GITHUB_OAUTH or both GITHUB_USER and GITHUB_PASSWORD environment variables",
instance.isAnonymous(),
is(false));
Matchers.is(false));
}

protected GHUser getUser() {
Expand Down Expand Up @@ -262,4 +262,28 @@ public static void assertThat(String reason, boolean assertion) {
}
}

public static void assertEquals(Object expected, Object actual) {
assertThat(actual, Matchers.equalTo(expected));
}

public static void assertNotEquals(Object expected, Object actual) {
assertThat(actual, Matchers.not(expected));
}

public static void assertNotNull(Object actual) {
assertThat(actual, Matchers.notNullValue());
}

public static void assertNull(Object actual) {
assertThat(actual, Matchers.nullValue());
}

public static void assertTrue(Boolean condition) {
assertThat(condition, Matchers.is(true));
}

public static void assertFalse(Boolean condition) {
assertThat(condition, Matchers.is(false));
}

}

0 comments on commit 32e5c5b

Please sign in to comment.