Coverage Report - jp.co.y_net.amm.common.InfoRenderer
 
Classes in this File Line Coverage Branch Coverage Complexity
InfoRenderer
0%
0/15
0%
0/4
2.5
 
 1  
 package jp.co.y_net.amm.common;
 2  
 
 3  
 import java.util.Date;
 4  
 
 5  
 import jp.co.y_net.amm.dao.Inf;
 6  
 
 7  0
 public class InfoRenderer {
 8  
 //    public static String execute(String title, String body) {
 9  
 //        return execute(title, "XXXX/XX/XX", body);
 10  
 //    }
 11  
     public static String execute(Inf inf) {
 12  0
         if(inf == null) {
 13  0
             return "";
 14  
         }
 15  0
         Date dPubdate = AppUtils.toDate(inf.getPubdate());
 16  
         String strPubdate;
 17  0
         if(dPubdate != null) {
 18  0
             strPubdate = Inf.DF_PUBDATE.format(dPubdate);
 19  0
         } else {
 20  0
             strPubdate = Inf.DF_PUBDATE.format(new Date());
 21  
         }
 22  
         
 23  0
         return execute(inf.getTitle(), strPubdate, inf.getBody());
 24  
     }
 25  
     private static String execute(String title, String pubdate, String body) {
 26  
         
 27  0
         body = body.replaceAll("\n", "<br />");
 28  
         
 29  0
         StringBuilder sb = new StringBuilder();
 30  0
         sb.append("<h2>" + title + "</h2>\n");
 31  0
         sb.append(pubdate + "<br />\n");
 32  
 //        sb.append("<br />\n");
 33  0
         sb.append(body);
 34  0
         return sb.toString();
 35  
     }
 36  
 
 37  
 
 38  
 
 39  
 }