Skip to content

Domain object Comments now sets the value of properties to JsonElemen… #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> properties();
public abstract Map<String, JsonElement> properties();

public abstract int id();

Expand Down Expand Up @@ -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<String, String> properties,
public static Comments create(Map<String, JsonElement> properties,
int id,
int version,
String text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down