CollectionConverter implements Converter { @Override public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object obj) { StringBuilder sb = new StringBuilder(); if (obj instanceof Collection) { @SuppressWarnings("unchecked") Collection<? extends Object> c = (Collection<? extends Object>) obj; for (Object o : c) { if (sb.length() != 0) { sb.append(", "); } sb.append(o.toString()); } } else { throw new IllegalArgumentException("Value must be a Collection type."); } return sb.toString(); }  @Override Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value); @Override String getAsString(FacesContext facesContext, UIComponent uiComponent, Object obj);  }
@Test public void testGetAsString_1() throws Exception { CollectionConverter fixture = new CollectionConverter(); Object obj = new ArrayList<String>(); String result = fixture.getAsString(null, null, obj); assertNotNull(result); }
@Test public void testGetAsString_2() throws Exception { CollectionConverter fixture = new CollectionConverter(); FacesContext facesContext = FacesContext.getCurrentInstance(); UIComponent uiComponent = new DynaForm(); Object obj = new LinkedList(); String result = fixture.getAsString(facesContext, uiComponent, obj); assertNotNull(result); }
@Test public void testGetAsString_3() throws Exception { CollectionConverter fixture = new CollectionConverter(); FacesContext facesContext = FacesContext.getCurrentInstance(); UIComponent uiComponent = new DynaForm(); Object obj = new LinkedList(); String result = fixture.getAsString(facesContext, uiComponent, obj); assertNotNull(result); }
@Test public void testGetAsString_4() throws Exception { CollectionConverter fixture = new CollectionConverter(); FacesContext facesContext = FacesContext.getCurrentInstance(); UIComponent uiComponent = new DynaForm(); Object obj = new LinkedList(); String result = fixture.getAsString(facesContext, uiComponent, obj); assertNotNull(result); }