mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
More assertThat matchers
This commit is contained in:
@@ -31,10 +31,7 @@ public class Github2faTest extends AbstractGitHubWireMockTest {
|
||||
});
|
||||
|
||||
assertThat(token, notNullValue());
|
||||
|
||||
for (int i = 0; i < asList.size(); i++) {
|
||||
assertThat(token.getScopes().get(i).contentEquals(asList.get(i)), is(true));
|
||||
}
|
||||
assertThat(token.getScopes(), contains(asList.toArray()));
|
||||
|
||||
assertThat(token.getToken(), equalTo("63042a99d88bf138e6d6cf5788e0dc4e7a5d7309"));
|
||||
assertThat(token.getTokenLastEight(), equalTo("7a5d7309"));
|
||||
|
||||
@@ -373,16 +373,16 @@ public class RequesterRetryTest extends AbstractGitHubWireMockTest {
|
||||
baseRequestCount = this.mockGitHub.getRequestCount();
|
||||
assertThat(this.gitHub.getOrganization(GITHUB_API_TEST_ORG), is(notNullValue()));
|
||||
String capturedLog = getTestCapturedLog();
|
||||
assertThat(capturedLog.contains("will try 2 more time"), is(true));
|
||||
assertThat(capturedLog.contains("will try 1 more time"), is(true));
|
||||
assertThat(capturedLog, containsString("will try 2 more time"));
|
||||
assertThat(capturedLog, containsString("will try 1 more time"));
|
||||
assertThat(this.mockGitHub.getRequestCount(), equalTo(baseRequestCount + expectedRequestCount));
|
||||
|
||||
resetTestCapturedLog();
|
||||
baseRequestCount = this.mockGitHub.getRequestCount();
|
||||
this.gitHub.createRequest().withUrlPath("/orgs/" + GITHUB_API_TEST_ORG).send();
|
||||
capturedLog = getTestCapturedLog();
|
||||
assertThat(capturedLog.contains("will try 2 more time"), is(true));
|
||||
assertThat(capturedLog.contains("will try 1 more time"), is(true));
|
||||
assertThat(capturedLog, containsString("will try 2 more time"));
|
||||
assertThat(capturedLog, containsString("will try 1 more time"));
|
||||
assertThat(this.mockGitHub.getRequestCount(), equalTo(baseRequestCount + expectedRequestCount));
|
||||
}
|
||||
|
||||
@@ -399,13 +399,13 @@ public class RequesterRetryTest extends AbstractGitHubWireMockTest {
|
||||
equalTo(200));
|
||||
String capturedLog = getTestCapturedLog();
|
||||
if (expectedRequestCount > 0) {
|
||||
assertThat(capturedLog.contains("will try 2 more time"), is(true));
|
||||
assertThat(capturedLog.contains("will try 1 more time"), is(true));
|
||||
assertThat(capturedLog, containsString("will try 2 more time"));
|
||||
assertThat(capturedLog, containsString("will try 1 more time"));
|
||||
assertThat(this.mockGitHub.getRequestCount(), equalTo(baseRequestCount + expectedRequestCount));
|
||||
} else {
|
||||
// Success without retries
|
||||
assertThat(capturedLog.contains("will try 2 more time"), is(false));
|
||||
assertThat(capturedLog.contains("will try 1 more time"), is(false));
|
||||
assertThat(capturedLog, not(containsString("will try 2 more time")));
|
||||
assertThat(capturedLog, not(containsString("will try 1 more time")));
|
||||
assertThat(this.mockGitHub.getRequestCount(), equalTo(baseRequestCount + 1));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user