1
2
3
4
5 package com.jcabi.github.mock;
6
7 import com.jcabi.github.Check;
8 import com.jcabi.github.Pull;
9 import java.io.IOException;
10 import org.hamcrest.MatcherAssert;
11 import org.hamcrest.Matchers;
12 import org.junit.jupiter.api.BeforeEach;
13 import org.junit.jupiter.api.Test;
14
15
16
17
18
19 final class MkCheckTest {
20
21
22
23
24 private transient Pull pull;
25
26
27
28
29
30 @BeforeEach
31 void setUp() throws IOException {
32 this.pull = new MkGitHub()
33 .randomRepo()
34 .pulls()
35 .create("Test PR", "abcdea8", "abcdea9");
36 }
37
38
39
40
41
42 @Test
43 void createsSuccessfulCheck() throws IOException {
44 MatcherAssert.assertThat(
45 "Values are not equal",
46 ((MkChecks) this.pull.checks())
47 .create(Check.Status.COMPLETED, Check.Conclusion.SUCCESS)
48 .successful(),
49 Matchers.is(true)
50 );
51 }
52
53
54
55
56
57 @Test
58 void createsFailedCheck() throws IOException {
59 MatcherAssert.assertThat(
60 "Values are not equal",
61 ((MkChecks) this.pull.checks())
62 .create(
63 Check.Status.COMPLETED,
64 Check.Conclusion.FAILURE
65 ).successful(),
66 Matchers.is(false)
67 );
68 }
69 }