diff --git a/src/main/java/com/cdancy/bitbucket/rest/domain/comment/Comments.java b/src/main/java/com/cdancy/bitbucket/rest/domain/comment/Comments.java index 28464b26..f38adb65 100644 --- a/src/main/java/com/cdancy/bitbucket/rest/domain/comment/Comments.java +++ b/src/main/java/com/cdancy/bitbucket/rest/domain/comment/Comments.java @@ -30,11 +30,12 @@ import com.cdancy.bitbucket.rest.domain.pullrequest.Author; import com.cdancy.bitbucket.rest.utils.Utils; import com.google.auto.value.AutoValue; +import com.google.gson.JsonElement; @AutoValue public abstract class Comments implements ErrorsHolder, LinksHolder { - public abstract Map properties(); + public abstract Map properties(); public abstract int id(); @@ -69,7 +70,7 @@ public abstract class Comments implements ErrorsHolder, LinksHolder { @SerializedNames({ "properties", "id", "version", "text", "author", "createdDate", "updatedDate", "comments", "tasks", "anchor", "link", "links", "permittedOperations", "errors" }) - public static Comments create(Map properties, + public static Comments create(Map properties, int id, int version, String text, diff --git a/src/test/java/com/cdancy/bitbucket/rest/features/CommentsApiMockTest.java b/src/test/java/com/cdancy/bitbucket/rest/features/CommentsApiMockTest.java index deae4491..a51d33d1 100644 --- a/src/test/java/com/cdancy/bitbucket/rest/features/CommentsApiMockTest.java +++ b/src/test/java/com/cdancy/bitbucket/rest/features/CommentsApiMockTest.java @@ -26,6 +26,7 @@ import com.cdancy.bitbucket.rest.internal.BaseBitbucketMockTest; import com.cdancy.bitbucket.rest.options.CreateComment; import com.google.common.collect.ImmutableMap; +import com.google.gson.JsonElement; import com.squareup.okhttp.mockwebserver.MockResponse; import com.squareup.okhttp.mockwebserver.MockWebServer; import org.testng.annotations.Test; @@ -149,6 +150,9 @@ public void testGetPullRequestComments() throws Exception { assertThat(firstComment.comments()).hasSize(1); assertThat(firstComment.comments().get(0).text()).isEqualTo("reply to comment in diff"); assertThat(firstComment.comments().get(0).id()).isEqualTo(5); + final JsonElement jsonElement = firstComment.properties().get("repositoryId"); + assertThat(jsonElement).isNotNull(); + assertThat(jsonElement.getAsInt()).isEqualTo(1); Comments secondComment = pcr.values().get(1); assertThat(secondComment.anchor().path()).isEqualTo("hej");