@Test public void valueWithTwoCookies(){ CookieField field = new CookieField(new Cookie("haircolor", "brown"), new Cookie("height", "10ft")); String text = field.value(); Assert.assertEquals("haircolor=brown;height=10ft", text); }
@Override public String value() { StringBuilder text = new StringBuilder(); for(int x=0;x<cookies.size();x++){ Cookie next = cookies.get(x); if(x!=0){ text.append(";"); } text.append(next.name + "=" + next.value); if(next.domain!=null){ text.append(";$Domain=" + next.domain); } if(next.path!=null){ text.append(";$Path=" + next.path); } } return text.toString(); }
CookieField extends HeaderField { @Override public String value() { StringBuilder text = new StringBuilder(); for(int x=0;x<cookies.size();x++){ Cookie next = cookies.get(x); if(x!=0){ text.append(";"); } text.append(next.name + "=" + next.value); if(next.domain!=null){ text.append(";$Domain=" + next.domain); } if(next.path!=null){ text.append(";$Path=" + next.path); } } return text.toString(); } }
CookieField extends HeaderField { @Override public String value() { StringBuilder text = new StringBuilder(); for(int x=0;x<cookies.size();x++){ Cookie next = cookies.get(x); if(x!=0){ text.append(";"); } text.append(next.name + "=" + next.value); if(next.domain!=null){ text.append(";$Domain=" + next.domain); } if(next.path!=null){ text.append(";$Path=" + next.path); } } return text.toString(); } CookieField(String fieldValue);  CookieField(Cookie ... cookies); }
CookieField extends HeaderField { @Override public String value() { StringBuilder text = new StringBuilder(); for(int x=0;x<cookies.size();x++){ Cookie next = cookies.get(x); if(x!=0){ text.append(";"); } text.append(next.name + "=" + next.value); if(next.domain!=null){ text.append(";$Domain=" + next.domain); } if(next.path!=null){ text.append(";$Path=" + next.path); } } return text.toString(); } CookieField(String fieldValue);  CookieField(Cookie ... cookies); @Override T accept(HeaderFieldVisitor<T> visitor); @Override String name(); List<Cookie> cookies(); @Override String value(); }
CookieField extends HeaderField { @Override public String value() { StringBuilder text = new StringBuilder(); for(int x=0;x<cookies.size();x++){ Cookie next = cookies.get(x); if(x!=0){ text.append(";"); } text.append(next.name + "=" + next.value); if(next.domain!=null){ text.append(";$Domain=" + next.domain); } if(next.path!=null){ text.append(";$Path=" + next.path); } } return text.toString(); } CookieField(String fieldValue);  CookieField(Cookie ... cookies); @Override T accept(HeaderFieldVisitor<T> visitor); @Override String name(); List<Cookie> cookies(); @Override String value();  }