1
2
3
4
5 package com.jcabi.github;
6
7 import com.jcabi.http.request.FakeRequest;
8 import org.apache.commons.lang3.RandomStringUtils;
9 import org.hamcrest.MatcherAssert;
10 import org.hamcrest.Matchers;
11 import org.junit.jupiter.api.Test;
12
13
14
15
16
17 final class RtRepoCommitTest {
18 @Test
19 void hasProperRequestUrl() {
20 final String sha = RandomStringUtils.secure().nextAlphanumeric(50);
21 final RtRepoCommit commit = new RtRepoCommit(
22 new FakeRequest(), RtRepoCommitTest.repo(), sha
23 );
24 MatcherAssert.assertThat(
25 "String does not end with expected value",
26 commit.toString(),
27 Matchers.endsWith(
28 String.format(
29 "/see-FakeRequest-class/repos/user/repo/commits/%s",
30 sha
31 )
32 )
33 );
34 }
35
36
37
38
39
40 private static Repo repo() {
41 return new RtGitHub().repos()
42 .get(new Coordinates.Simple("user", "repo"));
43 }
44
45 }