Coverage Report - org.paneris.jammyjoes.controller.TitleGenerator
 
Classes in this File Line Coverage Branch Coverage Complexity
TitleGenerator
0%
0/31
0%
0/28
4.5
 
 1  
 package org.paneris.jammyjoes.controller;
 2  
 
 3  
 
 4  
 public class TitleGenerator {
 5  
 
 6  
   private SearchType type;
 7  
   private SearchAge age;
 8  
   private SearchMaufacturer manufacturer;
 9  
   private boolean onlyAge;
 10  
   private String name;
 11  
   private String description;
 12  
 
 13  0
   public TitleGenerator(SearchType type, SearchAge age, SearchMaufacturer manufacturer, String name, String description) {
 14  0
     this.type = type;
 15  0
     this.age = age;
 16  0
     this.manufacturer = manufacturer;
 17  0
     this.name = name;
 18  0
     this.description = description;
 19  0
     if (type.isNull() && manufacturer.isNull() && !age.isNull()) {
 20  0
       onlyAge = true;
 21  
     }
 22  0
   }
 23  
 
 24  
   private String variableTitle() {
 25  0
     String title = "Creative, discovery and thinking toys for babies and kids";
 26  0
     if (name != null) {
 27  0
       return name;
 28  
     }
 29  0
     if (description != null) {
 30  0
       return description;
 31  
     }
 32  0
     if (!type.isNull()) {
 33  0
       title = type + " toys";;
 34  
     } else {
 35  0
       if (!manufacturer.isNull()) {
 36  0
         title = manufacturer + " toys";
 37  
       }
 38  
     }
 39  0
     if (onlyAge) {
 40  0
       title = age + " toys";
 41  
     } else {
 42  0
       if (!age.isNull()) {
 43  0
         title += " for " + age;
 44  
       }
 45  
     }
 46  0
     return title;
 47  
   }
 48  
 
 49  
   public String getTitle() {
 50  0
     return variableTitle() + " at Jammy Joes toy shop in Poole, Dorset, UK.";
 51  
   }
 52  
 
 53  
   public String getKeywords() {
 54  0
     String keywords = "";
 55  0
     if (!type.isNull()) keywords += type + ", ";
 56  0
     if (!age.isNull()) keywords += age + ", ";
 57  0
     if (!manufacturer.isNull()) keywords += manufacturer + ", ";
 58  0
     if (name != null) keywords += name + ", ";
 59  0
     if (description != null) keywords += description + ", ";
 60  0
     return keywords + "Creative, discovery and thinking toys for babies and kids at Jammy Joes toy shop in Poole, Dorset, UK.";
 61  
   }
 62  
 }