Skip to content

Commit 25915f7

Browse files
committed
add tag and push test
1 parent 2ed1987 commit 25915f7

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

platform-util-git/src/test/java/com/flow/platform/util/git/test/BitbucketWebhooksEventTest.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.flow.platform.util.git.hooks.BitbucketEvents.Hooks;
2020
import com.flow.platform.util.git.hooks.GitHookEventFactory;
21-
import com.flow.platform.util.git.model.GitEvent;
2221
import com.flow.platform.util.git.model.GitEventType;
2322
import com.flow.platform.util.git.model.GitPullRequestEvent;
2423
import com.flow.platform.util.git.model.GitPushTagEvent;
@@ -49,6 +48,16 @@ public void should_convert_to_push_event_obj() throws Throwable {
4948
Assert.assertNotNull(event);
5049
Assert.assertEquals(GitSource.BITBUCKET, event.getGitSource());
5150
Assert.assertEquals(GitEventType.PUSH, event.getType());
51+
Assert.assertEquals("200b5197debd10e0ca341e640422368b145eb254", event.getAfter());
52+
Assert.assertEquals("9429d1ee9fa16dc53d4dc5a0937693330aeda8bb", event.getBefore());
53+
Assert.assertEquals(
54+
"https://bitbucket.org/CodingWill/info/branches/compare/200b5197debd10e0ca341e640422368b145eb254..9429d1ee9fa16dc53d4dc5a0937693330aeda8bb",
55+
event.getCompareUrl());
56+
Assert.assertEquals("https://bitbucket.org/CodingWill/info/commits/200b5197debd10e0ca341e640422368b145eb254", event.getHeadCommitUrl());
57+
Assert.assertEquals("add 5\n", event.getMessage());
58+
Assert.assertEquals("CodingWill", event.getUsername());
59+
Assert.assertEquals("CodingWill", event.getUserEmail());
60+
Assert.assertEquals(4, event.getCommits().size());
5261
}
5362

5463
@Test
@@ -61,6 +70,13 @@ public void should_convert_to_tag_event_obj() throws Throwable {
6170
Assert.assertNotNull(event);
6271
Assert.assertEquals(GitSource.BITBUCKET, event.getGitSource());
6372
Assert.assertEquals(GitEventType.TAG, event.getType());
73+
74+
Assert.assertEquals("CodingWill", event.getUserEmail());
75+
Assert.assertEquals("CodingWill", event.getUsername());
76+
Assert.assertEquals("add tag\n", event.getMessage());
77+
Assert.assertEquals("https://bitbucket.org/CodingWill/info/commits/86edd5e14fd18bcf923b8eca522319896b2090e4", event.getHeadCommitUrl());
78+
Assert.assertEquals("86edd5e14fd18bcf923b8eca522319896b2090e4", event.getAfter());
79+
Assert.assertEquals(0, event.getCommits().size());
6480
}
6581

6682
@Test
@@ -88,7 +104,6 @@ public void should_convert_to_pr_close_event_obj() throws Throwable {
88104
}
89105

90106

91-
92107
private static String loadWebhookSampleJson(String classPath) throws IOException {
93108
URL resource = GitLabHooksEventTest.class.getClassLoader().getResource(classPath);
94109
return Files.toString(new File(resource.getFile()), Charset.forName("UTF-8"));

0 commit comments

Comments
 (0)