click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bck...@apache.org
Subject svn commit: r961490 - in /click/trunk/click: framework/test/org/apache/click/ framework/test/org/apache/click/control/ framework/test/org/apache/click/pages/ framework/test/org/apache/click/util/ mock/src/org/apache/click/
Date Wed, 07 Jul 2010 20:01:25 GMT
Author: bckfnn
Date: Wed Jul  7 20:01:25 2010
New Revision: 961490

URL: http://svn.apache.org/viewvc?rev=961490&view=rev
Log:
generics. CLK-696

Modified:
    click/trunk/click/framework/test/org/apache/click/PageTest.java
    click/trunk/click/framework/test/org/apache/click/control/ColumnCompareTest.java
    click/trunk/click/framework/test/org/apache/click/control/ColumnTest.java
    click/trunk/click/framework/test/org/apache/click/control/ContextAccessTest.java
    click/trunk/click/framework/test/org/apache/click/control/FormTest.java
    click/trunk/click/framework/test/org/apache/click/control/TableTest.java
    click/trunk/click/framework/test/org/apache/click/pages/BinaryPage.java
    click/trunk/click/framework/test/org/apache/click/pages/JspRedirectPage.java
    click/trunk/click/framework/test/org/apache/click/pages/RedirectToHtm.java
    click/trunk/click/framework/test/org/apache/click/pages/RedirectToJsp.java
    click/trunk/click/framework/test/org/apache/click/pages/RedirectToSelfPage.java
    click/trunk/click/framework/test/org/apache/click/pages/SetPathToJspPage.java
    click/trunk/click/framework/test/org/apache/click/util/ClickUtilsTest.java
    click/trunk/click/framework/test/org/apache/click/util/ContainerMessageMapTest.java
    click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java
    click/trunk/click/framework/test/org/apache/click/util/MessagesMapTest.java
    click/trunk/click/framework/test/org/apache/click/util/PropertyUtilsTest.java
    click/trunk/click/framework/test/org/apache/click/util/SessionMapTest.java
    click/trunk/click/mock/src/org/apache/click/MockContainer.java

Modified: click/trunk/click/framework/test/org/apache/click/PageTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/PageTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/PageTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/PageTest.java Wed Jul  7 20:01:25 2010
@@ -40,7 +40,7 @@ public class PageTest extends TestCase {
         String contextPath = container.getRequest().getContextPath();
         container.getRequest().setMethod("GET");
 
-        RedirectToHtm page = (RedirectToHtm) container.testPage(RedirectToHtm.class);
+        RedirectToHtm page = container.testPage(RedirectToHtm.class);
 
         // assert that the Page successfully redirected to test.htm
         String expected = contextPath + "/test.htm";
@@ -58,7 +58,7 @@ public class PageTest extends TestCase {
         String contextPath = container.getRequest().getContextPath();
         container.getRequest().setMethod("GET");
 
-        RedirectToJsp page = (RedirectToJsp) container.testPage(RedirectToJsp.class);
+        RedirectToJsp page = container.testPage(RedirectToJsp.class);
 
         // assert that the Page successfully redirected to jsp-page.htm, meaning
         // Click converted the Page JSP template from jsp-page.jsp to jsp-page.htm
@@ -77,7 +77,7 @@ public class PageTest extends TestCase {
         String contextPath = container.getRequest().getContextPath();
         container.getRequest().setMethod("GET");
 
-        JspRedirectPage page = (JspRedirectPage) container.testPage(JspRedirectPage.class);
+        JspRedirectPage page = container.testPage(JspRedirectPage.class);
 
         // assert that the Page successfully redirected to test.jsp, meaning
         // Click DID NOT convert the location from test.jsp to test.htm
@@ -118,7 +118,7 @@ public class PageTest extends TestCase {
         container.start();
         container.getRequest().setMethod("GET");
 
-        RedirectToSelfPage page = (RedirectToSelfPage) container.testPage(RedirectToSelfPage.class);
+        RedirectToSelfPage page = container.testPage(RedirectToSelfPage.class);
 
         assertEquals(RedirectToSelfPage.class.getName(), container.getRedirectPageClass().getName());
 
@@ -135,7 +135,7 @@ public class PageTest extends TestCase {
         container.start();
         container.getRequest().setMethod("GET");
 
-        SetPathToJspPage page = (SetPathToJspPage) container.testPage(SetPathToJspPage.class);
+        SetPathToJspPage page = container.testPage(SetPathToJspPage.class);
         assertEquals(SetPathToJspPage.PATH, container.getForward());
 
         container.stop();

Modified: click/trunk/click/framework/test/org/apache/click/control/ColumnCompareTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/control/ColumnCompareTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/control/ColumnCompareTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/control/ColumnCompareTest.java Wed Jul
 7 20:01:25 2010
@@ -40,7 +40,7 @@ public class ColumnCompareTest extends T
         table.addColumn(column);
 
         Column.ColumnComparator comparator = new Column.ColumnComparator(column);
-        List rowList = createRowList1();
+        List<Map<String, Object>> rowList = createRowList1();
         
         assertTrue(indexOf("-234", rowList) == 11);
         assertTrue(indexOf(Boolean.TRUE, rowList) == 3);
@@ -80,7 +80,7 @@ public class ColumnCompareTest extends T
         table.addColumn(column);
 
         Column.ColumnComparator comparator = new Column.ColumnComparator(column);
-        List rowList = createRowList2();
+        List<Map<String, Object>> rowList = createRowList2();
         Collections.sort(rowList, comparator);
 
         // Check sort order for ascending
@@ -113,7 +113,7 @@ public class ColumnCompareTest extends T
         table.addColumn(column);
 
         Column.ColumnComparator comparator = new Column.ColumnComparator(column);
-        List rowList = createRowList3();
+        List<Map<String, Object>> rowList = createRowList3();
         Collections.sort(rowList, comparator);
     }
 
@@ -122,8 +122,8 @@ public class ColumnCompareTest extends T
      *
      * @return a test Table row list
      */
-    private List createRowList1() {
-        List rowList = new ArrayList();
+    private List<Map<String, Object>> createRowList1() {
+        List<Map<String, Object>> rowList = new ArrayList<Map<String, Object>>();
 
         rowList.add(createRow("Dht"));
         rowList.add(createRow("DHT"));
@@ -153,8 +153,8 @@ public class ColumnCompareTest extends T
      *
      * @return a test Table row list
      */
-    private List createRowList2() {
-        List rowList = new ArrayList();
+    private List<Map<String, Object>> createRowList2() {
+        List<Map<String, Object>> rowList = new ArrayList<Map<String, Object>>();
 
         rowList.add(createRow(null));
         rowList.add(createRow(Boolean.TRUE));
@@ -168,8 +168,8 @@ public class ColumnCompareTest extends T
      *
      * @return a test Table row list
      */
-    private List createRowList3() {
-        List rowList = new ArrayList();
+    private List<Map<String, Object>> createRowList3() {
+        List<Map<String, Object>> rowList = new ArrayList<Map<String, Object>>();
 
         rowList.add(createRow("113L - 7 - 107"));
         rowList.add(createRow("113D - 7 - 107"));
@@ -187,7 +187,7 @@ public class ColumnCompareTest extends T
      * @param value the of the row
      * @return a map representing a Table row
      */
-    private Map createRow(Object value) {
+    private Map<String, Object> createRow(Object value) {
         return Collections.singletonMap("name", value);
     }
 
@@ -198,9 +198,9 @@ public class ColumnCompareTest extends T
      * @param rowList the rowList to find the object in
      * @return the index of the object in the rowList
      */
-    private int indexOf(Object value, List rowList) {
+    private int indexOf(Object value, List<Map<String, Object>> rowList) {
         for (int i = 0; i < rowList.size(); i++) {
-            Map row = (Map) rowList.get(i);
+            Map<String, Object> row = rowList.get(i);
             // Check for null value
             if (value == null) {
                 if (row.get("name") == null) {

Modified: click/trunk/click/framework/test/org/apache/click/control/ColumnTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/control/ColumnTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/control/ColumnTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/control/ColumnTest.java Wed Jul  7 20:01:25
2010
@@ -140,6 +140,7 @@ public class ColumnTest extends TestCase
             this.child = child;
         }
 
+        @Override
         public String toString() {
             return "TextObject [ " + getName() + ", " + getValue() + "]";
         }
@@ -164,6 +165,7 @@ public class ColumnTest extends TestCase
             this.name = name;
         }
         
+        @Override
         public String toString() {
             return "Child [ " + getName() + "]";
         }

Modified: click/trunk/click/framework/test/org/apache/click/control/ContextAccessTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/control/ContextAccessTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/control/ContextAccessTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/control/ContextAccessTest.java Wed Jul
 7 20:01:25 2010
@@ -33,7 +33,7 @@ public class ContextAccessTest extends T
 	private Object object;
 	
   /** ThreadLocal holder of Object to lookup. */
-	private static ThreadLocal threadLocal = new ThreadLocal();
+	private static ThreadLocal<Object> threadLocal = new ThreadLocal<Object>();
 	
   /**
    * Test performance of looking up an Object directly.

Modified: click/trunk/click/framework/test/org/apache/click/control/FormTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/control/FormTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/control/FormTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/control/FormTest.java Wed Jul  7 20:01:25
2010
@@ -37,7 +37,7 @@ public class FormTest extends TestCase {
      */
     public void testDuplicateOnSubmitCheck() {
         MockContext context = MockContext.initContext("test-form.htm");
-        MockRequest request = (MockRequest) context.getMockRequest();
+        MockRequest request = context.getMockRequest();
         request.setParameter("form_name", "form");
 
         Page page = new Page();
@@ -74,8 +74,8 @@ public class FormTest extends TestCase {
      * CLK-289.
      */
     public void testOnSubmitCheckMissingParam() {
-        MockContext context = (MockContext) MockContext.initContext("test-form.htm");
-        MockRequest request = (MockRequest) context.getMockRequest();
+        MockContext context = MockContext.initContext("test-form.htm");
+        MockRequest request = context.getMockRequest();
         request.getParameterMap().put("form_name", "form");
         Page page = new Page();
         Form form = new Form("form");
@@ -112,8 +112,8 @@ public class FormTest extends TestCase {
      */
     public void testFormOnProcessRequestBinding() {
         // Create a mock context
-        MockContext context = (MockContext) MockContext.initContext("test-form.htm");
-        MockRequest request = (MockRequest) context.getMockRequest();
+        MockContext context = MockContext.initContext("test-form.htm");
+        MockRequest request = context.getMockRequest();
 
         // The request value that should be set as the textField value
         String requestValue = "one";
@@ -358,7 +358,7 @@ public class FormTest extends TestCase {
         // Check that fieldWidth has entry for field
         assertTrue(testForm.getFieldWidths().size() == 1);
         
-        Integer width = (Integer) testForm.getFieldWidths().get(field.getName());
+        Integer width = testForm.getFieldWidths().get(field.getName());
         assertEquals(4, width.intValue());
 
         testForm.remove(field);
@@ -383,7 +383,7 @@ public class FormTest extends TestCase {
         // Check that fieldWidth has entry for table
         assertTrue(testForm.getFieldWidths().size() == 1);
         
-        Integer width = (Integer) testForm.getFieldWidths().get(table.getName());
+        Integer width = testForm.getFieldWidths().get(table.getName());
         assertEquals(4, width.intValue());
 
         testForm.remove(table);

Modified: click/trunk/click/framework/test/org/apache/click/control/TableTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/control/TableTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/control/TableTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/control/TableTest.java Wed Jul  7 20:01:25
2010
@@ -52,7 +52,7 @@ public class TableTest extends TestCase 
     public void testTdId() {
         MockContext.initContext();
         
-        List foos = new ArrayList();
+        List<Foo> foos = new ArrayList<Foo>();
         foos.add(new Foo("foo1"));
         foos.add(new Foo("foo2"));
 
@@ -77,7 +77,7 @@ public class TableTest extends TestCase 
     public void testPagingCurrentPage() {
         MockContext.initContext();
 
-        List foos = new ArrayList();
+        List<Foo> foos = new ArrayList<Foo>();
         for (int i = 0; i < 1000; i++) {
             foos.add(new Foo("foo" + i));
         }
@@ -106,7 +106,7 @@ public class TableTest extends TestCase 
     public void testSetRowAttributes() {
         MockContext.initContext();
 
-        List foos = new ArrayList();
+        List<Foo> foos = new ArrayList<Foo>();
         for (int i = 0; i < 3; i++) {
             foos.add(new Foo("foo" + i));
         }

Modified: click/trunk/click/framework/test/org/apache/click/pages/BinaryPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/pages/BinaryPage.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/pages/BinaryPage.java (original)
+++ click/trunk/click/framework/test/org/apache/click/pages/BinaryPage.java Wed Jul  7 20:01:25
2010
@@ -27,6 +27,7 @@ import org.apache.click.Page;
  */
 public class BinaryPage extends Page {
 
+    @Override
     public void onInit() {
         try {
             Context context = getContext();

Modified: click/trunk/click/framework/test/org/apache/click/pages/JspRedirectPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/pages/JspRedirectPage.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/pages/JspRedirectPage.java (original)
+++ click/trunk/click/framework/test/org/apache/click/pages/JspRedirectPage.java Wed Jul 
7 20:01:25 2010
@@ -26,6 +26,7 @@ public class JspRedirectPage extends Red
     /**
      * Initialize page.
      */
+    @Override
     public void onInit() {
         setRedirect("/test.jsp");
     }

Modified: click/trunk/click/framework/test/org/apache/click/pages/RedirectToHtm.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/pages/RedirectToHtm.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/pages/RedirectToHtm.java (original)
+++ click/trunk/click/framework/test/org/apache/click/pages/RedirectToHtm.java Wed Jul  7
20:01:25 2010
@@ -28,6 +28,7 @@ public class RedirectToHtm extends Page 
     /**
      * Redirect to test.htm path.
      */
+    @Override
     public void onInit() {
         setRedirect("/test.htm");
     }

Modified: click/trunk/click/framework/test/org/apache/click/pages/RedirectToJsp.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/pages/RedirectToJsp.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/pages/RedirectToJsp.java (original)
+++ click/trunk/click/framework/test/org/apache/click/pages/RedirectToJsp.java Wed Jul  7
20:01:25 2010
@@ -28,6 +28,7 @@ public class RedirectToJsp extends Page 
     /**
      * Redirect to JspPage.
      */
+    @Override
     public void onInit() {
         setRedirect(JspPage.class);
     }

Modified: click/trunk/click/framework/test/org/apache/click/pages/RedirectToSelfPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/pages/RedirectToSelfPage.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/pages/RedirectToSelfPage.java (original)
+++ click/trunk/click/framework/test/org/apache/click/pages/RedirectToSelfPage.java Wed Jul
 7 20:01:25 2010
@@ -28,6 +28,7 @@ public class RedirectToSelfPage extends 
     /**
      * Redirect to self.
      */
+    @Override
     public void onInit() {
         // Redirect to self
         setRedirect(RedirectToSelfPage.class);

Modified: click/trunk/click/framework/test/org/apache/click/pages/SetPathToJspPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/pages/SetPathToJspPage.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/pages/SetPathToJspPage.java (original)
+++ click/trunk/click/framework/test/org/apache/click/pages/SetPathToJspPage.java Wed Jul
 7 20:01:25 2010
@@ -30,6 +30,7 @@ public class SetPathToJspPage extends Pa
     /**
      * Set path to non-existent dummy.jsp
      */
+    @Override
     public void onInit() {
         setPath(PATH);
     }

Modified: click/trunk/click/framework/test/org/apache/click/util/ClickUtilsTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/util/ClickUtilsTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/util/ClickUtilsTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/util/ClickUtilsTest.java Wed Jul  7
20:01:25 2010
@@ -59,6 +59,7 @@ public class ClickUtilsTest extends Test
     /**
      * Setup a MockContext for each test.
      */
+    @Override
     protected void setUp() {
     	MockContext.initContext(Locale.ENGLISH);
     }
@@ -202,7 +203,7 @@ public class ClickUtilsTest extends Test
         form.copyFrom(user, true);
         assertEquals("NSW", codeField.getValueObject());
         
-        Map map = new HashMap();
+        Map<String, Object> map = new HashMap<String, Object>();
         map.put("name", "malcolm");
         form = new Form();
         TextField nameField2 = new TextField("name");
@@ -225,7 +226,7 @@ public class ClickUtilsTest extends Test
         String street = "12 Short street";
         
         // Setup the map
-        Map map = new HashMap();
+        Map<String, Object> map = new HashMap<String, Object>();
         map.put("id", id);
         map.put("name", name);
         map.put("age", age);
@@ -275,7 +276,7 @@ public class ClickUtilsTest extends Test
         String street = "12 Short street";
 
         // Setup the map with no values
-        Map map = new HashMap();
+        Map<String, Object> map = new HashMap<String, Object>();
         map.put("id", null);
         map.put("name", null);
         map.put("age", null);
@@ -377,7 +378,7 @@ public class ClickUtilsTest extends Test
     public void testGetParentMessages() {
         TextField textField = new TextField("test");
         
-        Map map = ClickUtils.getParentMessages(textField);
+        Map<String, String> map = ClickUtils.getParentMessages(textField);
         assertNotNull(map);
         assertTrue(map.isEmpty());
         assertTrue(map == Collections.EMPTY_MAP);
@@ -385,7 +386,7 @@ public class ClickUtilsTest extends Test
         Page page = new Page();
         page.addControl(textField);
         
-        Map map2 = ClickUtils.getParentMessages(textField);
+        Map<String, String> map2 = ClickUtils.getParentMessages(textField);
         assertNotNull(map2);
         assertEquals(1, map2.size());
         assertFalse(map2 == Collections.EMPTY_MAP);
@@ -398,7 +399,7 @@ public class ClickUtilsTest extends Test
         TextField textField2 = new TextField("test");
         form.add(textField2);
 
-        Map map3 = ClickUtils.getParentMessages(textField2);
+        Map<String, String> map3 = ClickUtils.getParentMessages(textField2);
         assertNotNull(map3);
         assertEquals(1, map3.size());
         assertFalse(map3 == Collections.EMPTY_MAP);        

Modified: click/trunk/click/framework/test/org/apache/click/util/ContainerMessageMapTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/util/ContainerMessageMapTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/util/ContainerMessageMapTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/util/ContainerMessageMapTest.java Wed
Jul  7 20:01:25 2010
@@ -45,7 +45,7 @@ public class ContainerMessageMapTest ext
         MyForm form = new MyForm("myform");
         page.addControl(form);
         Field customField = form.getField("customField");
-        Map map = form.getMessages();
+        Map<String, String> map = form.getMessages();
         assertFalse(map.isEmpty());
         assertTrue(map.size() >= 2);
         assertEquals("Custom Name", customField.getLabel());

Modified: click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/util/ContainerUtilsTest.java Wed Jul
 7 20:01:25 2010
@@ -22,6 +22,7 @@ import java.util.List;
 import junit.framework.TestCase;
 import org.apache.click.MockContext;
 import org.apache.click.control.Button;
+import org.apache.click.control.Field;
 import org.apache.click.control.FieldSet;
 import org.apache.click.control.Form;
 import org.apache.click.control.HiddenField;
@@ -61,7 +62,7 @@ public class ContainerUtilsTest extends 
         Button button = new Button("button");
         form.add(button);
         
-        List fields = ContainerUtils.getInputFields(form);
+        List<Field> fields = ContainerUtils.getInputFields(form);
         
         // Total should be 4 consisting of the fields "hidden", "id" and the
         // Forms internal HiddenFields "form_name" and "bypass_validation".

Modified: click/trunk/click/framework/test/org/apache/click/util/MessagesMapTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/util/MessagesMapTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/util/MessagesMapTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/util/MessagesMapTest.java Wed Jul  7
20:01:25 2010
@@ -246,7 +246,7 @@ public class MessagesMapTest extends Tes
      */
     private class ReloadableMessagesMap extends MessagesMap {
 
-        public ReloadableMessagesMap(Class baseClass, String globalResource) {
+        public ReloadableMessagesMap(Class<?> baseClass, String globalResource) {
             super(baseClass, globalResource);
             clearCache();
         }
@@ -258,10 +258,10 @@ public class MessagesMapTest extends Tes
 
         private void clearResourceBundleCache() {
             try {
-                Class type = ResourceBundle.class;
+                Class<?> type = ResourceBundle.class;
                 Field cacheList = type.getDeclaredField("cacheList");
                 cacheList.setAccessible(true);
-                ((Map) cacheList.get(ResourceBundle.class)).clear();
+                ((Map<?, ?>) cacheList.get(ResourceBundle.class)).clear();
                 cacheList.setAccessible(false);
             } catch (Exception jvmNotSupported) {
                 System.out.println("WARNING: Could not clear the MessagesMap " +

Modified: click/trunk/click/framework/test/org/apache/click/util/PropertyUtilsTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/util/PropertyUtilsTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/util/PropertyUtilsTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/util/PropertyUtilsTest.java Wed Jul
 7 20:01:25 2010
@@ -34,21 +34,21 @@ public class PropertyUtilsTest extends T
      */
     public void testGetProperty() {
         try {
-            PropertyUtils.getValue(new Object(), "username", new HashMap());
+            PropertyUtils.getValue(new Object(), "username", new HashMap<Object, Object>());
             assertTrue(false);
         } catch (Exception e) {
             assertTrue(true);
         }
 
         try {
-            PropertyUtils.getValue(new Object(), "class", new HashMap());
+            PropertyUtils.getValue(new Object(), "class", new HashMap<Object, Object>());
             assertTrue(true);
         } catch (Exception e) {
             assertTrue(false);
         }
 
         ParentObject testObject = new ParentObject();
-        Map cache = new HashMap();
+        Map<?, ?> cache = new HashMap<Object, Object>();
 
         assertNull(PropertyUtils.getValue(testObject, "name", cache));
         assertNull(PropertyUtils.getValue(testObject, "value", cache));
@@ -88,7 +88,7 @@ public class PropertyUtilsTest extends T
      * Test that PropertyUtils can extract value from Map.
      */
     public void testMap() {
-        Map map = new HashMap();
+        Map<String, Object> map = new HashMap<String, Object>();
         map.put("name", "malcolm");
 
         assertEquals("malcolm", PropertyUtils.getValue(map, "name"));

Modified: click/trunk/click/framework/test/org/apache/click/util/SessionMapTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/test/org/apache/click/util/SessionMapTest.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/framework/test/org/apache/click/util/SessionMapTest.java (original)
+++ click/trunk/click/framework/test/org/apache/click/util/SessionMapTest.java Wed Jul  7
20:01:25 2010
@@ -144,7 +144,7 @@ public class SessionMapTest extends Test
         
         container.getRequest().setMethod("GET");
 
-        SessionMapPage page = (SessionMapPage) container.testPage(SessionMapPage.class);
+        container.testPage(SessionMapPage.class);
         Assert.assertTrue(container.getHtml().contains("attrib1=value1"));
         
         container.stop();

Modified: click/trunk/click/mock/src/org/apache/click/MockContainer.java
URL: http://svn.apache.org/viewvc/click/trunk/click/mock/src/org/apache/click/MockContainer.java?rev=961490&r1=961489&r2=961490&view=diff
==============================================================================
--- click/trunk/click/mock/src/org/apache/click/MockContainer.java (original)
+++ click/trunk/click/mock/src/org/apache/click/MockContainer.java Wed Jul  7 20:01:25 2010
@@ -25,7 +25,6 @@ import org.apache.click.servlet.MockRequ
 import java.io.File;
 import java.io.PrintStream;
 import java.io.PrintWriter;
-import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -434,16 +433,14 @@ public class MockContainer {
      * @param parameters the request parameters
      * @return the Page instance for the specified pageClass
      */
-    public Page testPage(Class pageClass, Map parameters) {
+    public <T extends Page> Page testPage(Class<T> pageClass, Map<?, ?>
parameters) {
         if (pageClass == null) {
             throw new IllegalArgumentException("pageClass cannot be null");
         }
         if (parameters == null) {
             throw new IllegalArgumentException("Parameters cannot be null");
         }
-        Iterator it = parameters.entrySet().iterator();
-        while (it.hasNext()) {
-            Entry entry = (Entry) it.next();
+        for (Entry<?, ?> entry : parameters.entrySet()) {
             setParameter(String.valueOf(entry.getKey()),
                 String.valueOf(entry.getValue()));
         }
@@ -460,7 +457,8 @@ public class MockContainer {
      * @param pageClass specifies the class of the Page to test
      * @return the Page instance for the specified pageClass
      */
-    public Page testPage(Class pageClass) {
+    @SuppressWarnings("unchecked")
+    public <T extends Page> T testPage(Class<T> pageClass) {
         if (!started) {
             throw new IllegalStateException("Container has not been started yet. Call start()
first.");
         }
@@ -481,7 +479,7 @@ public class MockContainer {
 
             getRequest().setServletPath(servletPath);
             getClickServlet().service(request, getResponse());
-            return getPage();
+            return (T) getPage();
 
         } catch (RuntimeException ex) {
             throw ex;
@@ -508,7 +506,7 @@ public class MockContainer {
             throw new IllegalArgumentException("path cannot be null");
         }
         path = appendLeadingSlash(path);
-        Class pageClass = getClickServlet().getConfigService().getPageClass(path);
+        Class<? extends Page> pageClass = getClickServlet().getConfigService().getPageClass(path);
         return testPage(pageClass);
     }
 
@@ -527,12 +525,12 @@ public class MockContainer {
      *
      * @return a new Page instance for the specified path
      */
-    public Page testPage(String path, Map parameters) {
+    public Page testPage(String path, Map<?, ?> parameters) {
         if (path == null) {
             throw new IllegalArgumentException("path cannot be null");
         }
         path = appendLeadingSlash(path);
-        Class pageClass = getClickServlet().getConfigService().getPageClass(path);
+        Class<? extends Page> pageClass = getClickServlet().getConfigService().getPageClass(path);
         return testPage(pageClass, parameters);
     }
 
@@ -595,7 +593,7 @@ public class MockContainer {
      *
      * @return the class that Page forwarded to
      */
-    public Class getForwardPageClass() {
+    public Class<? extends Page> getForwardPageClass() {
         if (Context.getContextStack().isEmpty()) {
             return null;
         }
@@ -620,7 +618,7 @@ public class MockContainer {
      *
      * @return the Class that Page redirected to
      */
-    public Class getRedirectPageClass() {
+    public Class<? extends Page> getRedirectPageClass() {
         if (Context.getContextStack().isEmpty()) {
             return null;
         }
@@ -780,6 +778,7 @@ public class MockContainer {
          *
          * @return localized description of this exception
          */
+        @Override
         public String getLocalizedMessage() {
             if (getCause() == null) {
                 return super.getLocalizedMessage();
@@ -795,6 +794,7 @@ public class MockContainer {
          *
          * @return the exception error message
          */
+        @Override
         public String getMessage() {
             if (getCause() == null) {
                 return super.getMessage();
@@ -810,6 +810,7 @@ public class MockContainer {
          *
          * @param printStream the PrintStream to print to
          */
+        @Override
         public void printStackTrace(PrintStream printStream) {
             synchronized (printStream) {
                 if (getCause() == null) {
@@ -825,6 +826,7 @@ public class MockContainer {
          *
          * @param printWriter the PrintWriter to print to
          */
+        @Override
         public void printStackTrace(PrintWriter printWriter) {
             synchronized (printWriter) {
                 if (getCause() == null) {
@@ -841,6 +843,7 @@ public class MockContainer {
          * @return a reference to either the underlying cause (if its defined)
          * or this Throwable instance.
          */
+        @Override
         public synchronized Throwable fillInStackTrace() {
             if (getCause() == null) {
                 return this;



Mime
View raw message