Author: abelevich
Date: 2008-03-11 08:31:00 -0400 (Tue, 11 Mar 2008)
New Revision: 6682
Modified:
trunk/ui/combobox/src/test/java/org/richfaces/component/ComboBoxComponentTest.java
trunk/ui/combobox/src/test/java/org/richfaces/renderkit/ComboBoxRendererTest.java
Log:
format code
Modified:
trunk/ui/combobox/src/test/java/org/richfaces/component/ComboBoxComponentTest.java
===================================================================
---
trunk/ui/combobox/src/test/java/org/richfaces/component/ComboBoxComponentTest.java 2008-03-11
12:25:36 UTC (rev 6681)
+++
trunk/ui/combobox/src/test/java/org/richfaces/component/ComboBoxComponentTest.java 2008-03-11
12:31:00 UTC (rev 6682)
@@ -44,122 +44,121 @@
public class ComboBoxComponentTest extends AbstractAjax4JsfTestCase {
- UIComboBox comboBox;
- UIForm form;
- String suggestions =
"Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,Florida,Massachusetts,Michigan,Georgia,Hawaii,Idaho,Indiana,Iowa,Kansas,Kentucky,Louisiana,Maine,Minnesota,Mississippi,Missouri,Montana,Nebraska";
- List selectItems = new ArrayList();
+ UIComboBox comboBox;
+ UIForm form;
+ String suggestions =
"Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,Florida,Massachusetts,Michigan,Georgia,Hawaii,Idaho,Indiana,Iowa,Kansas,Kentucky,Louisiana,Maine,Minnesota,Mississippi,Missouri,Montana,Nebraska";
+ List selectItems = new ArrayList();
-
- private static Set javaScripts = new HashSet();
+ private static Set javaScripts = new HashSet();
- static {
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
- javaScripts.add("scripts/comboboxUtils.js");
- javaScripts.add("scripts/combobox.js");
- javaScripts.add("scripts/combolist.js");
- javaScripts.add("org/richfaces/renderkit/html/scripts/utils.js");
+ static {
+ javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("scripts/comboboxUtils.js");
+ javaScripts.add("scripts/combobox.js");
+ javaScripts.add("scripts/combolist.js");
+ javaScripts.add("org/richfaces/renderkit/html/scripts/utils.js");
- }
-
- public ComboBoxComponentTest( String testName ) {
- super( testName );
}
- public void setUp() throws Exception {
- super.setUp();
-
- form = new HtmlForm();
- form.setId("form");
- facesContext.getViewRoot().getChildren().add(form);
-
- comboBox =
(UIComboBox)application.createComponent("org.richfaces.ComboBox");
- comboBox.setSuggestionValues(Arrays.asList(suggestions.split(",")));
-
- selectItems.add(new SelectItem("District of Columbia"));
- selectItems.add(new SelectItem("Illinois"));
- selectItems.add(new SelectItem("Maryland"));
- selectItems.add(new SelectItem("Nevada"));
- selectItems.add(new SelectItem("New Hampshire"));
- selectItems.add(new SelectItem("New Jersey"));
-
- UISelectItem item1 = new UISelectItem();
- item1.setValue(new SelectItem("Oregon"));
-
- UISelectItem item2 = new UISelectItem();
- item2.setValue(new SelectItem("Pennsylvania"));
-
- UISelectItem item3 = new UISelectItem();
- item3.setValue(new SelectItem("Rhode Island"));
-
- UISelectItem item4 = new UISelectItem();
- item4.setValue(new SelectItem("South Carolina"));
-
- comboBox.getChildren().add(item1);
- comboBox.getChildren().add(item2);
- comboBox.getChildren().add(item3);
- comboBox.getChildren().add(item4);
-
-
- UISelectItems items = new UISelectItems();
- items.setValue(selectItems);
- comboBox.getChildren().add(items);
- form.getChildren().add(comboBox);
+ public ComboBoxComponentTest(String testName) {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ comboBox = (UIComboBox)
application.createComponent("org.richfaces.ComboBox");
+ comboBox.setSuggestionValues(Arrays.asList(suggestions.split(",")));
+
+ selectItems.add(new SelectItem("District of Columbia"));
+ selectItems.add(new SelectItem("Illinois"));
+ selectItems.add(new SelectItem("Maryland"));
+ selectItems.add(new SelectItem("Nevada"));
+ selectItems.add(new SelectItem("New Hampshire"));
+ selectItems.add(new SelectItem("New Jersey"));
+
+ UISelectItem item1 = new UISelectItem();
+ item1.setValue(new SelectItem("Oregon"));
+
+ UISelectItem item2 = new UISelectItem();
+ item2.setValue(new SelectItem("Pennsylvania"));
+
+ UISelectItem item3 = new UISelectItem();
+ item3.setValue(new SelectItem("Rhode Island"));
+
+ UISelectItem item4 = new UISelectItem();
+ item4.setValue(new SelectItem("South Carolina"));
+
+ comboBox.getChildren().add(item1);
+ comboBox.getChildren().add(item2);
+ comboBox.getChildren().add(item3);
+ comboBox.getChildren().add(item4);
+
+ UISelectItems items = new UISelectItems();
+ items.setValue(selectItems);
+ comboBox.getChildren().add(items);
+ form.getChildren().add(comboBox);
+ }
+
+ public void testRender() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ }
+
+ public void testComboBoxStyles() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ List links = page.getDocumentElement().getHtmlElementsByTagName("link");
+ if (links.size() == 0) {
+ fail();
}
-
- public void testRender() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
+ for (int i = 0; i < links.size(); i++) {
+ HtmlElement link = (HtmlElement) links.get(i);
+
assertTrue(link.getAttributeValue("href").contains("css/combobox.xcss"));
}
-
- public void testComboBoxStyles() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
- List links = page.getDocumentElement().getHtmlElementsByTagName("link");
- if(links.size()==0){fail();}
- for (int i = 0; i < links.size(); i++) {
- HtmlElement link = (HtmlElement) links.get(i);
- assertTrue(link.getAttributeValue("href").contains(
- "css/combobox.xcss"));
- }
- }
-
- public void testComboBoxScripts() throws Exception {
- HtmlPage page = renderView();
- assertNotNull(page);
+ }
- List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
- for (Iterator it = scripts.iterator(); it.hasNext();) {
- HtmlScript item = (HtmlScript) it.next();
- String srcAttr = item.getSrcAttribute();
- if (item.getFirstChild() != null) {
- String scriptBodyString = item.getFirstChild().toString();
- if (scriptBodyString.contains("Richfaces.ComboBox")) {
- assertTrue(scriptBodyString.contains("Richfaces.ComboBox.CLASSES"));
- }
- }
+ public void testComboBoxScripts() throws Exception {
+ HtmlPage page = renderView();
+ assertNotNull(page);
- if (StringUtils.isNotBlank(srcAttr)) {
- boolean found = false;
- for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
- String src = (String) srcIt.next();
- found = srcAttr.contains(src);
- if (found) {
- break;
- }
- }
- assertTrue(found);
- }
+ List scripts = page.getDocumentElement().getHtmlElementsByTagName("script");
+ for (Iterator it = scripts.iterator(); it.hasNext();) {
+ HtmlScript item = (HtmlScript) it.next();
+ String srcAttr = item.getSrcAttribute();
+ if (item.getFirstChild() != null) {
+ String scriptBodyString = item.getFirstChild().toString();
+ if (scriptBodyString.contains("Richfaces.ComboBox")) {
+ assertTrue(scriptBodyString.contains("Richfaces.ComboBox.CLASSES"));
}
+ }
+
+ if (StringUtils.isNotBlank(srcAttr)) {
+ boolean found = false;
+ for (Iterator srcIt = javaScripts.iterator(); srcIt.hasNext();) {
+ String src = (String) srcIt.next();
+ found = srcAttr.contains(src);
+ if (found) {
+ break;
+ }
+ }
+ assertTrue(found);
+ }
}
-
- public void tearDown() throws Exception {
- // TODO Auto-generated method stub
- form = null;
- comboBox = null;
- super.tearDown();
- }
-
+ }
+
+ public void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ form = null;
+ comboBox = null;
+ super.tearDown();
+ }
+
public void testComponent() {
- assertTrue( true );
+ assertTrue(true);
}
}
Modified:
trunk/ui/combobox/src/test/java/org/richfaces/renderkit/ComboBoxRendererTest.java
===================================================================
---
trunk/ui/combobox/src/test/java/org/richfaces/renderkit/ComboBoxRendererTest.java 2008-03-11
12:25:36 UTC (rev 6681)
+++
trunk/ui/combobox/src/test/java/org/richfaces/renderkit/ComboBoxRendererTest.java 2008-03-11
12:31:00 UTC (rev 6682)
@@ -26,74 +26,70 @@
*/
public class ComboBoxRendererTest extends AbstractAjax4JsfTestCase {
- private UIComponent form;
- private UIComboBox comboBox;
- private ComboBoxRenderer renderer;
- String suggestions =
"Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,Florida,Massachusetts,Michigan,Georgia,Hawaii,Idaho,Indiana,Iowa,Kansas,Kentucky,Louisiana,Maine,Minnesota,Mississippi,Missouri,Montana,Nebraska";
- List selectItems = new ArrayList();
+ private UIComponent form;
+ private UIComboBox comboBox;
+ private ComboBoxRenderer renderer;
+ String suggestions =
"Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,Florida,Massachusetts,Michigan,Georgia,Hawaii,Idaho,Indiana,Iowa,Kansas,Kentucky,Louisiana,Maine,Minnesota,Mississippi,Missouri,Montana,Nebraska";
+ List selectItems = new ArrayList();
+ public void setUp() throws Exception {
+ super.setUp();
+ renderer = new ComboBoxRenderer();
+ comboBox = (UIComboBox)
application.createComponent("org.richfaces.ComboBox");
+ comboBox.setSuggestionValues(Arrays.asList(suggestions.split(",")));
+ selectItems.add(new SelectItem("District of Columbia"));
+ selectItems.add(new SelectItem("Illinois"));
+ selectItems.add(new SelectItem("Maryland"));
+ selectItems.add(new SelectItem("Nevada"));
+ selectItems.add(new SelectItem("New Hampshire"));
+ selectItems.add(new SelectItem("New Jersey"));
-
- public void setUp() throws Exception {
- super.setUp();
- renderer = new ComboBoxRenderer();
- comboBox =
(UIComboBox)application.createComponent("org.richfaces.ComboBox");
- comboBox.setSuggestionValues(Arrays.asList(suggestions.split(",")));
-
- selectItems.add(new SelectItem("District of Columbia"));
- selectItems.add(new SelectItem("Illinois"));
- selectItems.add(new SelectItem("Maryland"));
- selectItems.add(new SelectItem("Nevada"));
- selectItems.add(new SelectItem("New Hampshire"));
- selectItems.add(new SelectItem("New Jersey"));
-
- UISelectItem item1 = new UISelectItem();
- item1.setValue(new SelectItem("Oregon"));
-
- UISelectItem item2 = new UISelectItem();
- item2.setValue(new SelectItem("Pennsylvania"));
-
- UISelectItem item3 = new UISelectItem();
- item3.setValue(new SelectItem("Rhode Island"));
-
- UISelectItem item4 = new UISelectItem();
- item4.setValue(new SelectItem("South Carolina"));
-
- comboBox.getChildren().add(item1);
- comboBox.getChildren().add(item2);
- comboBox.getChildren().add(item3);
- comboBox.getChildren().add(item4);
-
- UISelectItems items = new UISelectItems();
- items.setValue(selectItems);
- facesContext.getViewRoot().getChildren().add(comboBox);
-
- Map requestMap = facesContext.getExternalContext().getRequestParameterMap();
- String id = "comboBoxValue" + comboBox.getClientId(facesContext);
- requestMap.put(id, "Pennsylvania");
- }
-
- public void itemsTextAsJSArrayTest() {
- String script = renderer.getItemsTextAsJSArray(facesContext, comboBox);
- assertNotNull(script);
- }
-
- public void testRender() throws Exception{
-
- HtmlPage page = renderView();
- assertNotNull(page);
- HtmlElement elem = page.getHtmlElementById(comboBox.getClientId(facesContext));
- assertNotNull(elem);
- assertEquals(elem.getTagName(), "div");
- }
-
-
- public void tearDown() throws Exception {
- super.tearDown();
- renderer = null;
- }
-
- public ComboBoxRendererTest(String name) {
- super(name);
- }
+ UISelectItem item1 = new UISelectItem();
+ item1.setValue(new SelectItem("Oregon"));
+
+ UISelectItem item2 = new UISelectItem();
+ item2.setValue(new SelectItem("Pennsylvania"));
+
+ UISelectItem item3 = new UISelectItem();
+ item3.setValue(new SelectItem("Rhode Island"));
+
+ UISelectItem item4 = new UISelectItem();
+ item4.setValue(new SelectItem("South Carolina"));
+
+ comboBox.getChildren().add(item1);
+ comboBox.getChildren().add(item2);
+ comboBox.getChildren().add(item3);
+ comboBox.getChildren().add(item4);
+
+ UISelectItems items = new UISelectItems();
+ items.setValue(selectItems);
+ facesContext.getViewRoot().getChildren().add(comboBox);
+
+ Map requestMap = facesContext.getExternalContext().getRequestParameterMap();
+ String id = "comboBoxValue" + comboBox.getClientId(facesContext);
+ requestMap.put(id, "Pennsylvania");
+ }
+
+ public void itemsTextAsJSArrayTest() {
+ String script = renderer.getItemsTextAsJSArray(facesContext, comboBox);
+ assertNotNull(script);
+ }
+
+ public void testRender() throws Exception {
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ HtmlElement elem = page.getHtmlElementById(comboBox.getClientId(facesContext));
+ assertNotNull(elem);
+ assertEquals(elem.getTagName(), "div");
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ renderer = null;
+ }
+
+ public ComboBoxRendererTest(String name) {
+ super(name);
+ }
}