1
2
3
4
5 package com.jcabi.github.mock;
6
7 import com.jcabi.github.Gist;
8 import java.io.IOException;
9 import java.util.Collections;
10 import org.hamcrest.MatcherAssert;
11 import org.hamcrest.Matchers;
12 import org.junit.jupiter.api.Test;
13
14
15
16
17
18 final class MkGistTest {
19
20
21
22
23 @Test
24 void readEmptyGistFile() throws IOException {
25
26 final String filename = "file.txt";
27 final Gist gist = new MkGitHub().gists().create(
28 Collections.singletonMap(filename, ""), false
29 );
30 MatcherAssert.assertThat(
31 "Values are not equal",
32 gist.read(filename),
33 Matchers.is(Matchers.emptyString())
34 );
35 }
36
37
38
39
40
41 @Test
42 void fork() throws IOException {
43 final String filename = "file.txt";
44 final Gist gist = new MkGitHub().gists().create(
45 Collections.singletonMap(filename, ""), false
46 );
47 gist.write(filename, "Hello, github!");
48 final Gist fork = gist.fork();
49 MatcherAssert.assertThat(
50 "Values are not equal",
51 fork.read(filename),
52 Matchers.equalTo(gist.read(filename))
53 );
54 }
55 }