1
2
3
4
5 package com.jcabi.github;
6
7 import com.jcabi.github.mock.MkGitHub;
8 import com.jcabi.http.mock.MkAnswer;
9 import com.jcabi.http.mock.MkContainer;
10 import com.jcabi.http.mock.MkGrizzlyContainer;
11 import com.jcabi.http.request.ApacheRequest;
12 import java.io.IOException;
13 import java.net.HttpURLConnection;
14 import org.hamcrest.MatcherAssert;
15 import org.hamcrest.Matchers;
16 import org.junit.jupiter.api.Test;
17 import org.junit.jupiter.api.extension.ExtendWith;
18
19
20
21
22
23
24 @ExtendWith(RandomPort.class)
25 final class RtTagTest {
26
27
28
29
30
31 @Test
32 void fetchesContent() throws IOException {
33 final MkContainer container = new MkGrizzlyContainer().next(
34 new MkAnswer.Simple(
35 HttpURLConnection.HTTP_OK,
36 "{\"sha\":\"abdes00test\", \"tag\":\"v.0.1\"}"
37 )
38 ).start(RandomPort.port());
39 final Tag tag = new RtTag(
40 new ApacheRequest(container.home()),
41 new MkGitHub().randomRepo(),
42 "abdes00test"
43 );
44 try {
45 MatcherAssert.assertThat(
46 "Values are not equal",
47 tag.json().getString("tag"),
48 Matchers.is("v.0.1")
49 );
50 } finally {
51 container.stop();
52 }
53 }
54 }