##### Coverage Report - models.Comment

Classes in this File | Line Coverage | Branch Coverage | Complexity
Comment |
100 % | 7/7
50 % | 1/2
| 1.5;1,5

1 |  |
     package models;
2 |  |
3 |  |
     import java.util.*;
4 |  |
     import javax.persistence.*;
5 |  |
6 |  |
     import play.db.jpa.*;
7 |  |
     import play.data.validation.*;
8 |  |
9 |  |
     @Entity
10 |  |
     public class Comment extends Model {
11 |  |
12 |  |
         @Required
13 |  |
         public String author;
14 |  |
15 |  |
         @Required
16 |  |
         public Date postedAt;
17 |  |
18 |  |
         @Lob
19 |  |
         @Required
20 |  |
         @MaxSize(10000)
21 |  |
         public String content;
22 |  |
23 |  |
         @ManyToOne
24 |  |
         @Required
25 |  |
         public Post post;
26 |  |
27 | 15 |
         public Comment(Post post, String author, String content) {
28 | 15 |
             this.post = post;
29 | 15 |
             this.author = author;
30 | 15 |
             this.content = content;
31 | 15 |
             this.postedAt = new Date();
32 | 15 |
         }
33 |  |
34 |  |
         public String toString() {
35 | 48 |
             return content.length() > 50 ? content.substring(0, 50) + "..." : content;
36 |  |
         }
37 |  |
38 |  |
     }