package fr.mmarie.api.jira;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.dropwizard.jackson.Jackson;
import org.junit.Test;

import java.io.IOException;

import static fr.mmarie.api.jira.Assertions.assertThat;
import static io.dropwizard.testing.FixtureHelpers.fixture;
import static org.assertj.core.api.Assertions.assertThat;

public class CommentTest {

    private static final ObjectMapper MAPPER = Jackson.newObjectMapper();

    @Test
    public void serializesToJSON() throws IOException {
        final Comment comment = new Comment("This is a comment");

        final String expected = MAPPER.writeValueAsString(
                MAPPER.readValue(fixture("fixtures/jira/comment.json"), Comment.class));

        assertThat(MAPPER.writeValueAsString(comment)).isEqualTo(expected);
    }

    @Test
    public void deserializesFromJSON() throws IOException {
        final Comment comment = MAPPER.readValue(fixture("fixtures/jira/comment.json"), Comment.class);

        assertThat(comment).hasBody("This is a comment");
    }

}
@@ -1048,9 +1048,227 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void testToString() throws Exception %7B%0A        final Comment comment = new Comment(%22This is a comment%22);%0A%0A        assertThat(comment.toString()).isEqualTo(%22Comment(body=This is a comment)%22);%0A    %7D%0A
 %7D

add toString test for Comment