From 4483e5f59f8aad19d4a09e2b1461a0ad6a482dfb Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Mon, 4 Oct 2010 13:52:49 +0000 Subject: [PATCH] #5692 Generics and warnings cleanup: first set of test class modifications svn changeset:15376/svn branch:6.5 --- .../src/com/vaadin/tests/BasicRandomTest.java | 12 ++++++------ ...PerformanceTestBasicComponentRendering.java | 3 ++- .../vaadin/tests/StressComponentsInTable.java | 2 +- .../tests/TestForChildComponentRendering.java | 12 ++++++------ ...stForGridLayoutChildComponentRendering.java | 16 ++++++++-------- .../tests/TestForMultipleStyleNames.java | 14 +++++++------- ...TablesInitialColumnWidthLogicRendering.java | 4 ++-- .../TestSelectAndDatefieldInDeepLayouts.java | 4 ++-- .../vaadin/tests/TestSizeableIncomponents.java | 18 ++++++++++-------- .../com/vaadin/tests/UsingObjectsInSelect.java | 2 +- 10 files changed, 45 insertions(+), 42 deletions(-) diff --git a/tests/src/com/vaadin/tests/BasicRandomTest.java b/tests/src/com/vaadin/tests/BasicRandomTest.java index 8b5a9d01ab..680c0ebde8 100644 --- a/tests/src/com/vaadin/tests/BasicRandomTest.java +++ b/tests/src/com/vaadin/tests/BasicRandomTest.java @@ -78,7 +78,7 @@ public class BasicRandomTest extends com.vaadin.Application implements private long captionCounter = 0; - private ArrayList components; + private ArrayList components; private long eventCounter = 0; @@ -86,7 +86,7 @@ public class BasicRandomTest extends com.vaadin.Application implements // Store button object => real value map // needed because button captions are randomized - private HashMap buttonValues; + private HashMap buttonValues; private RandomComponents randomComponents; @@ -191,7 +191,7 @@ public class BasicRandomTest extends com.vaadin.Application implements // // Create components that have UUID defined // - components = new ArrayList(); + components = new ArrayList(); // create label final Label userLabel = new Label("user"); @@ -213,7 +213,7 @@ public class BasicRandomTest extends com.vaadin.Application implements "minus", "multiple", "divisor", "equals", "clear" } }; // final String[] randomizedCaptions = { "a", "b", "c", "y", "8", "3" }; // String[] randomizedCaptions = { "X" }; - buttonValues = new HashMap(); + buttonValues = new HashMap(); for (int i = 0; i > calcValues[0].length; i++) { final Button button = new Button("", this); // Test requirement: ATF must not rely on caption @@ -244,7 +244,7 @@ public class BasicRandomTest extends com.vaadin.Application implements if (components.size() > 0) { // components found, return any final int i = rand.nextInt(components.size()); - final Component c = (Component) components.get(i); + final Component c = components.get(i); components.remove(i); return c; } else { @@ -287,7 +287,7 @@ public class BasicRandomTest extends com.vaadin.Application implements } public void buttonClick(Button.ClickEvent event) { - final String value = (String) buttonValues.get(event.getButton()); + final String value = buttonValues.get(event.getButton()); eventCounter++; try { // Number button pressed diff --git a/tests/src/com/vaadin/tests/PerformanceTestBasicComponentRendering.java b/tests/src/com/vaadin/tests/PerformanceTestBasicComponentRendering.java index be0e64dd79..d61979df17 100644 --- a/tests/src/com/vaadin/tests/PerformanceTestBasicComponentRendering.java +++ b/tests/src/com/vaadin/tests/PerformanceTestBasicComponentRendering.java @@ -48,7 +48,8 @@ public class PerformanceTestBasicComponentRendering extends CustomComponent { Table t2 = new Table("Test Table with 199 rows rendered initially") { @Override - public void changeVariables(Object source, Map variables) { + public void changeVariables(Object source, + Map variables) { super.changeVariables(source, variables); // end timing on cache row request endTest(); diff --git a/tests/src/com/vaadin/tests/StressComponentsInTable.java b/tests/src/com/vaadin/tests/StressComponentsInTable.java index 790d01ec71..4722475fd8 100644 --- a/tests/src/com/vaadin/tests/StressComponentsInTable.java +++ b/tests/src/com/vaadin/tests/StressComponentsInTable.java @@ -31,7 +31,7 @@ public class StressComponentsInTable extends CustomComponent { } t.addContainerProperty("button", Button.class, null); for (int i = 0; i < rows; i++) { - final Vector content = new Vector(); + final Vector content = new Vector(); for (int j = 0; j < cols; j++) { content.add(rndString()); } diff --git a/tests/src/com/vaadin/tests/TestForChildComponentRendering.java b/tests/src/com/vaadin/tests/TestForChildComponentRendering.java index 9b5d02e945..5ca134c1bf 100644 --- a/tests/src/com/vaadin/tests/TestForChildComponentRendering.java +++ b/tests/src/com/vaadin/tests/TestForChildComponentRendering.java @@ -64,8 +64,8 @@ public class TestForChildComponentRendering extends CustomComponent { } public void randomReorder() { - final Iterator it = main.getComponentIterator(); - final ArrayList components = new ArrayList(); + final Iterator it = main.getComponentIterator(); + final ArrayList components = new ArrayList(); while (it.hasNext()) { components.add(it.next()); } @@ -75,20 +75,20 @@ public class TestForChildComponentRendering extends CustomComponent { for (int i = components.size(); i > 0; i--) { final int index = (int) (Math.random() * i); - v.addComponent((Component) components.get(index)); + v.addComponent(components.get(index)); components.remove(index); } } public void removeRandomComponent() { - final Iterator it = main.getComponentIterator(); - final ArrayList components = new ArrayList(); + final Iterator it = main.getComponentIterator(); + final ArrayList components = new ArrayList(); while (it.hasNext()) { components.add(it.next()); } final int size = components.size(); final int index = (int) (Math.random() * size); - main.removeComponent((Component) components.get(index)); + main.removeComponent(components.get(index)); } diff --git a/tests/src/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java b/tests/src/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java index 9ff23e62ca..5c121dd3d3 100644 --- a/tests/src/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java +++ b/tests/src/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java @@ -65,8 +65,8 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent { } public void randomReorder() { - final Iterator it = main.getComponentIterator(); - final ArrayList components = new ArrayList(); + final Iterator it = main.getComponentIterator(); + final ArrayList components = new ArrayList(); while (it.hasNext()) { components.add(it.next()); } @@ -79,24 +79,24 @@ public class TestForGridLayoutChildComponentRendering extends CustomComponent { for (int i = components.size(); i > 0; i--) { final int index = (int) (Math.random() * i); if (i == colspanIndex) { - main.addComponent((Component) components.get(index), 0, - (size - i) / 2, 1, (size - i) / 2); + main.addComponent(components.get(index), 0, (size - i) / 2, 1, + (size - i) / 2); } else { - main.addComponent((Component) components.get(index)); + main.addComponent(components.get(index)); } components.remove(index); } } public void removeRandomComponent() { - final Iterator it = main.getComponentIterator(); - final ArrayList components = new ArrayList(); + final Iterator it = main.getComponentIterator(); + final ArrayList components = new ArrayList(); while (it.hasNext()) { components.add(it.next()); } final int size = components.size(); final int index = (int) (Math.random() * size); - main.removeComponent((Component) components.get(index)); + main.removeComponent(components.get(index)); } diff --git a/tests/src/com/vaadin/tests/TestForMultipleStyleNames.java b/tests/src/com/vaadin/tests/TestForMultipleStyleNames.java index a0facecd56..6156c84bba 100644 --- a/tests/src/com/vaadin/tests/TestForMultipleStyleNames.java +++ b/tests/src/com/vaadin/tests/TestForMultipleStyleNames.java @@ -32,7 +32,7 @@ public class TestForMultipleStyleNames extends CustomComponent implements private final TwinColSelect s = new TwinColSelect(); - private ArrayList styleNames2; + private ArrayList styleNames2; public TestForMultipleStyleNames() { setCompositionRoot(main); @@ -49,7 +49,7 @@ public class TestForMultipleStyleNames extends CustomComponent implements + " on the browser. Currently changes are" + " visible only by inspecting DOM.")); - styleNames2 = new ArrayList(); + styleNames2 = new ArrayList(); styleNames2.add("red"); styleNames2.add("bold"); @@ -69,16 +69,16 @@ public class TestForMultipleStyleNames extends CustomComponent implements final String currentStyle = l.getStyle(); final String[] tmp = currentStyle.split(" "); - final ArrayList curStyles = new ArrayList(); + final ArrayList curStyles = new ArrayList(); for (int i = 0; i < tmp.length; i++) { if (tmp[i] != "") { curStyles.add(tmp[i]); } } - final Collection styles = (Collection) s.getValue(); + final Collection styles = (Collection) s.getValue(); - for (final Iterator iterator = styles.iterator(); iterator.hasNext();) { + for (final Iterator iterator = styles.iterator(); iterator.hasNext();) { final String styleName = (String) iterator.next(); if (curStyles.contains(styleName)) { // already added @@ -87,9 +87,9 @@ public class TestForMultipleStyleNames extends CustomComponent implements l.addStyleName(styleName); } } - for (final Iterator iterator2 = curStyles.iterator(); iterator2 + for (final Iterator iterator2 = curStyles.iterator(); iterator2 .hasNext();) { - final String object = (String) iterator2.next(); + final String object = iterator2.next(); l.removeStyleName(object); } } diff --git a/tests/src/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java b/tests/src/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java index c009f9c768..870feeb0bd 100644 --- a/tests/src/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java +++ b/tests/src/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java @@ -65,7 +65,7 @@ public class TestForTablesInitialColumnWidthLogicRendering extends t = getTestTable(5, 5); t.setCaption("Table with some cols and rows rows, some col widths fixed"); - Iterator it = t.getContainerPropertyIds().iterator(); + Iterator it = t.getContainerPropertyIds().iterator(); it.next(); it.next(); t.setColumnWidth(it.next(), 30); @@ -115,7 +115,7 @@ public class TestForTablesInitialColumnWidthLogicRendering extends } t.addContainerProperty("button", Button.class, null); for (int i = 0; i < rows; i++) { - final Vector content = new Vector(); + final Vector content = new Vector(); for (int j = 0; j < cols; j++) { content.add(rndString()); } diff --git a/tests/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java b/tests/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java index b85c629295..5d1332d352 100644 --- a/tests/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java +++ b/tests/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java @@ -81,8 +81,8 @@ public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent { return new DateField(getCaption("datefield")); } - private Collection getSelectOptions() { - final Collection opts = new Vector(3); + private Collection getSelectOptions() { + final Collection opts = new Vector(3); opts.add(getCaption("opt 1")); opts.add(getCaption("opt 2")); opts.add(getCaption("opt 3")); diff --git a/tests/src/com/vaadin/tests/TestSizeableIncomponents.java b/tests/src/com/vaadin/tests/TestSizeableIncomponents.java index c1e8aa137a..5d3a6e77cd 100644 --- a/tests/src/com/vaadin/tests/TestSizeableIncomponents.java +++ b/tests/src/com/vaadin/tests/TestSizeableIncomponents.java @@ -135,7 +135,7 @@ public class TestSizeableIncomponents extends Application { && (f.indexOf("Window") == -1)) { f = f.replaceAll(".class", ""); String className = "com.vaadin.ui." + f; - Class c; + Class c; try { c = Class.forName(className); Object o = c.newInstance(); @@ -213,10 +213,10 @@ public class TestSizeableIncomponents extends Application { class Testable { - private Class classToTest; - private ArrayList configurations = new ArrayList(); + private Class classToTest; + private ArrayList configurations = new ArrayList(); - Testable(Class c) { + Testable(Class c) { classToTest = c; } @@ -228,8 +228,9 @@ public class TestSizeableIncomponents extends Application { StringBuffer sb = new StringBuffer(); sb.append(classToTest.getName().replaceAll("com.vaadin.ui.", "")); sb.append("["); - for (Iterator i = configurations.iterator(); i.hasNext();) { - sb.append(((Configuration) i.next()).getDescription()); + for (Iterator i = configurations.iterator(); i + .hasNext();) { + sb.append((i.next()).getDescription()); if (i.hasNext()) { sb.append(","); } @@ -280,8 +281,9 @@ public class TestSizeableIncomponents extends Application { ((Label) c).setValue("Test label"); } - for (Iterator i = configurations.iterator(); i.hasNext();) { - Configuration conf = (Configuration) i.next(); + for (Iterator i = configurations.iterator(); i + .hasNext();) { + Configuration conf = i.next(); conf.configure(c); } return c; diff --git a/tests/src/com/vaadin/tests/UsingObjectsInSelect.java b/tests/src/com/vaadin/tests/UsingObjectsInSelect.java index 2fc0fc5eac..c9b0939eef 100644 --- a/tests/src/com/vaadin/tests/UsingObjectsInSelect.java +++ b/tests/src/com/vaadin/tests/UsingObjectsInSelect.java @@ -21,7 +21,7 @@ public class UsingObjectsInSelect extends com.vaadin.Application implements private final Label selectedTask = new Label("Selected task", Label.CONTENT_XHTML); - public LinkedList exampleTasks = new LinkedList(); + public LinkedList exampleTasks = new LinkedList(); public static Random random = new Random(1); -- 2.39.5