package de.vorb.platon.model;

import com.google.common.truth.Truth;
import org.junit.Test;

public class CommentTest {

    @Test
    public void testSetParentId() throws Exception {

        final Comment comment = new Comment();
        final long parentId = 42;

        comment.setParentId(parentId);

        Truth.assertThat(comment.getParentId()).isEqualTo(parentId);

        comment.setParentId(null);

        Truth.assertThat(comment.getParent()).isNull();

    }
}

@@ -77,18 +77,222 @@
 org.
-junit.Test
+apache.commons.codec.digest.MessageDigestAlgorithms;%0Aimport org.junit.Test;%0A%0Aimport java.nio.charset.StandardCharsets;%0Aimport java.security.MessageDigest;%0Aimport java.util.Arrays;%0Aimport java.util.function.Supplier
 ;%0A%0Ap
@@ -671,12 +671,1759 @@
 );%0A%0A
-
     %7D%0A
+%0A    @Test%0A    public void testSetEmail() throws Exception %7B%0A%0A        final Comment comment = new Comment();%0A        comment.setEmail(null);%0A%0A        Truth.assertThat(comment.getEmailHash()).isNull();%0A%0A        final String emailAddress = %22user@example.com%22;%0A        comment.setEmail(emailAddress);%0A%0A        final byte%5B%5D referenceHash = MessageDigest.getInstance(MessageDigestAlgorithms.MD5)%0A                .digest(emailAddress.getBytes(StandardCharsets.UTF_8));%0A%0A        Truth.assertThat(Arrays.equals(comment.getEmailHash(), referenceHash)).isTrue();%0A%0A    %7D%0A%0A    @Test%0A    public void testSetEmailHash() throws Exception %7B%0A        new Comment().setEmailHash(new byte%5B16%5D);%0A    %7D%0A%0A    @Test(expected = IllegalArgumentException.class)%0A    public void testSetEmailHashWithInvalidLength() throws Exception %7B%0A        new Comment().setEmailHash(new byte%5B0%5D);%0A    %7D%0A%0A    @Test%0A    public void testEquals() throws Exception %7B%0A%0A        final Comment comment = new Comment();%0A        Truth.assertThat(comment).isNotEqualTo(null);%0A        Truth.assertThat(comment).isEqualTo(comment);%0A        Truth.assertThat(comment).isEqualTo(new Comment());%0A%0A        Truth.assertThat(NEW_COMMENT.get()).isEqualTo(NEW_COMMENT.get());%0A    %7D%0A%0A    @Test%0A    public void testHashCode() throws Exception %7B%0A        Truth.assertThat(NEW_COMMENT.get().hashCode()).isEqualTo(NEW_COMMENT.get().hashCode());%0A    %7D%0A%0A    private static final Supplier%3CComment%3E NEW_COMMENT = () -%3E %7B%0A        final Comment c = new Comment();%0A        c.setId(2L);%0A        c.setParentId(1L);%0A        c.setThread(new CommentThread());%0A        c.setText(%22Comment text%22);%0A        c.setAuthor(%22User%22);%0A        c.setEmail(%22user@example.com%22);%0A        c.setUrl(%22http://example.com%22);%0A        return c;%0A    %7D;%0A%0A
 %7D%0A

Improve CommentTest