Skip to content

Commit bde6ad9

Browse files
committed
Add a test for check updates
1 parent 4953f45 commit bde6ad9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,26 @@ public void createCheckRunErrMissingConclusion() throws Exception {
114114
}
115115
}
116116

117+
@Test
118+
public void updateCheckRun() throws Exception {
119+
GHCheckRun checkRun = gitHub.getRepository("jglick/github-api-test")
120+
.createCheckRun("foo", "4a929d464a2fae7ee899ce603250f7dab304bc4b")
121+
.withStatus(GHCheckRun.Status.IN_PROGRESS)
122+
.withStartedAt(new Date(999_999_000))
123+
.add(new GHCheckRunBuilder.Output("Some Title", "what happened…")
124+
.add(new GHCheckRunBuilder.Annotation("stuff.txt",
125+
1,
126+
GHCheckRun.AnnotationLevel.NOTICE,
127+
"hello to you too").withTitle("Look here")))
128+
.create();
129+
GHCheckRun updated = checkRun.update()
130+
.withStatus(GHCheckRun.Status.COMPLETED)
131+
.withConclusion(GHCheckRun.Conclusion.SUCCESS)
132+
.withCompletedAt(new Date(999_999_999))
133+
.create();
134+
assertEquals(updated.getStartedAt(), new Date(999_999_000));
135+
assertEquals(updated.getName(), "foo");
136+
assertEquals(1, checkRun.getOutput().getAnnotationsCount());
137+
}
138+
117139
}

0 commit comments

Comments
 (0)