-
Notifications
You must be signed in to change notification settings - Fork 24
/
ArcSubclassesCliTest.java
88 lines (79 loc) · 3.88 KB
/
ArcSubclassesCliTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package io.quarkiverse.githubapp.it.command.airline;
import static io.quarkiverse.githubapp.it.command.airline.util.CommandTestUtils.verifyCommandExecution;
import static io.quarkiverse.githubapp.testing.GitHubAppTesting.when;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import org.kohsuke.github.GHEvent;
import org.kohsuke.github.ReactionContent;
import io.quarkiverse.githubapp.testing.GitHubAppTest;
import io.quarkus.test.junit.QuarkusTest;
@QuarkusTest
@GitHubAppTest
public class ArcSubclassesCliTest {
@Test
void testApplicationScopedScopeIssues() throws IOException {
when().payloadFromClasspath("/issue-comment-arc-application-scoped-command1-issue.json")
.event(GHEvent.ISSUE_COMMENT)
.then().github(mocks -> {
verify(mocks.issueComment(1093016219))
.createReaction(ReactionContent.ROCKET);
verify(mocks.issue(1168785554))
.comment("hello from @arc application-scoped-command1");
verify(mocks.issueComment(1093016219))
.createReaction(ReactionContent.PLUS_ONE);
verifyNoMoreInteractions(mocks.ghObjects());
});
when().payloadFromClasspath("/issue-comment-arc-application-scoped-command1-pr.json")
.event(GHEvent.ISSUE_COMMENT)
.then().github(mocks -> {
verifyNoMoreInteractions(mocks.ghObjects());
});
}
@Test
void testApplicationScopedScopeIssuesAndPullRequests() throws IOException {
when().payloadFromClasspath("/issue-comment-arc-application-scoped-command2-issue.json")
.event(GHEvent.ISSUE_COMMENT)
.then().github(mocks -> {
verifyCommandExecution(mocks, "hello from @arc application-scoped-command2");
});
when().payloadFromClasspath("/issue-comment-arc-application-scoped-command2-pr.json")
.event(GHEvent.ISSUE_COMMENT)
.then().github(mocks -> {
verifyCommandExecution(mocks, "hello from @arc application-scoped-command2");
});
}
@Test
void testSubclassScopeIssues() throws IOException {
when().payloadFromClasspath("/issue-comment-arc-subclass-command1-issue.json")
.event(GHEvent.ISSUE_COMMENT)
.then().github(mocks -> {
verify(mocks.issueComment(1093016219))
.createReaction(ReactionContent.ROCKET);
verify(mocks.issue(1168785554))
.comment("hello from @arc subclass-command1");
verify(mocks.issueComment(1093016219))
.createReaction(ReactionContent.PLUS_ONE);
verifyNoMoreInteractions(mocks.ghObjects());
});
when().payloadFromClasspath("/issue-comment-arc-subclass-command1-pr.json")
.event(GHEvent.ISSUE_COMMENT)
.then().github(mocks -> {
verifyNoMoreInteractions(mocks.ghObjects());
});
}
@Test
void testSubclassScopeIssuesAndPullRequests() throws IOException {
when().payloadFromClasspath("/issue-comment-arc-subclass-command2-issue.json")
.event(GHEvent.ISSUE_COMMENT)
.then().github(mocks -> {
verifyCommandExecution(mocks, "hello from @arc subclass-command2");
});
when().payloadFromClasspath("/issue-comment-arc-subclass-command2-pr.json")
.event(GHEvent.ISSUE_COMMENT)
.then().github(mocks -> {
verifyCommandExecution(mocks, "hello from @arc subclass-command2");
});
}
}