1
2
3
4
5 package com.jcabi.github.mock;
6
7 import com.jcabi.github.Tree;
8 import jakarta.json.Json;
9 import jakarta.json.JsonObject;
10 import java.io.IOException;
11 import org.hamcrest.MatcherAssert;
12 import org.hamcrest.Matchers;
13 import org.junit.jupiter.api.Test;
14
15
16
17
18
19
20 final class MkTreeTest {
21
22
23
24
25
26 @Test
27 void fetchesContent() throws Exception {
28 MatcherAssert.assertThat(
29 "Values are not equal",
30 MkTreeTest.tree().json().getString("message"),
31 Matchers.is("\"test tree\"")
32 );
33 }
34
35
36
37
38
39 private static Tree tree() throws IOException {
40 final JsonObject json = Json.createObjectBuilder().add(
41 "tree",
42 Json.createArrayBuilder().add(
43 Json.createObjectBuilder()
44 .add("sha", "abcsha12").add("message", "test tree")
45 .add("name", "v.0.1").build()
46 )
47 ).build();
48 return new MkGitHub().randomRepo().git().trees().create(json);
49 }
50
51 }