tiles-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r933750 - in /tiles/sandbox/trunk/tiles-request/tiles-request-api/src: main/java/org/apache/tiles/request/scope/ main/java/org/apache/tiles/request/util/ test/java/org/apache/tiles/request/ test/java/org/apache/tiles/request/scope/ test/jav...
Date Tue, 13 Apr 2010 19:16:07 GMT
Author: apetrelli
Date: Tue Apr 13 19:16:06 2010
New Revision: 933750

URL: http://svn.apache.org/viewvc?rev=933750&view=rev
Log:
TILESSB-11
Completed unit tests for tiles-request-api.

Added:
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/NotAvailableFeatureExceptionTest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/RequestExceptionTest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/NoSuchScopeExceptionTest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/ReflectionContextResolverTest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationAccessTest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationContextWrapperTest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/MapEntryTest.java   (with props)
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/RequestWrapperTest.java   (with props)
Modified:
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/scope/ReflectionContextResolver.java
    tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/ApplicationContextWrapper.java

Modified: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/scope/ReflectionContextResolver.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/scope/ReflectionContextResolver.java?rev=933750&r1=933749&r2=933750&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/scope/ReflectionContextResolver.java (original)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/scope/ReflectionContextResolver.java Tue Apr 13 19:16:06 2010
@@ -3,7 +3,6 @@ package org.apache.tiles.request.scope;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
@@ -45,7 +44,7 @@ public class ReflectionContextResolver i
 
     @Override
     public String[] getAvailableScopes(Request request) {
-        Set<String> scopes = new HashSet<String>();
+        Set<String> scopes = new LinkedHashSet<String>();
         boolean finished = false;
         do {
             scopes.addAll(getSpecificScopeSet(request));

Modified: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/ApplicationContextWrapper.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/ApplicationContextWrapper.java?rev=933750&r1=933749&r2=933750&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/ApplicationContextWrapper.java (original)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/main/java/org/apache/tiles/request/util/ApplicationContextWrapper.java Tue Apr 13 19:16:06 2010
@@ -75,11 +75,11 @@ public class ApplicationContextWrapper i
 
     /** {@inheritDoc} */
     public URL getResource(String path) throws IOException {
-        return getResource(path);
+        return context.getResource(path);
     }
 
     /** {@inheritDoc} */
     public Set<URL> getResources(String path) throws IOException {
-        return getResources(path);
+        return context.getResources(path);
     }
 }

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/NotAvailableFeatureExceptionTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/NotAvailableFeatureExceptionTest.java?rev=933750&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/NotAvailableFeatureExceptionTest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/NotAvailableFeatureExceptionTest.java Tue Apr 13 19:16:06 2010
@@ -0,0 +1,77 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tiles.request;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * Tests {@link NotAvailableFeatureException}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NotAvailableFeatureExceptionTest {
+
+    /**
+     * Test method for {@link org.apache.tiles.request.NotAvailableFeatureException#NotAvailableFeatureException()}.
+     */
+    @Test
+    public void testNotAvailableFeatureException() {
+        NotAvailableFeatureException exception = new NotAvailableFeatureException();
+        assertNull(exception.getMessage());
+        assertNull(exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.NotAvailableFeatureException#NotAvailableFeatureException(java.lang.String)}.
+     */
+    @Test
+    public void testNotAvailableFeatureExceptionString() {
+        NotAvailableFeatureException exception = new NotAvailableFeatureException("my message");
+        assertEquals("my message", exception.getMessage());
+        assertNull(exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.NotAvailableFeatureException#NotAvailableFeatureException(java.lang.Throwable)}.
+     */
+    @Test
+    public void testNotAvailableFeatureExceptionThrowable() {
+        Throwable cause = new Throwable();
+        NotAvailableFeatureException exception = new NotAvailableFeatureException(cause);
+        assertEquals(cause.toString(), exception.getMessage());
+        assertEquals(cause, exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.NotAvailableFeatureException#NotAvailableFeatureException(java.lang.String, java.lang.Throwable)}.
+     */
+    @Test
+    public void testNotAvailableFeatureExceptionStringThrowable() {
+        Throwable cause = new Throwable();
+        NotAvailableFeatureException exception = new NotAvailableFeatureException("my message", cause);
+        assertEquals("my message", exception.getMessage());
+        assertEquals(cause, exception.getCause());
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/NotAvailableFeatureExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/NotAvailableFeatureExceptionTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/RequestExceptionTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/RequestExceptionTest.java?rev=933750&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/RequestExceptionTest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/RequestExceptionTest.java Tue Apr 13 19:16:06 2010
@@ -0,0 +1,77 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tiles.request;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * Tests {@link RequestException}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestExceptionTest {
+
+    /**
+     * Test method for {@link org.apache.tiles.request.RequestException#RequestException()}.
+     */
+    @Test
+    public void testRequestException() {
+        RequestException exception = new RequestException();
+        assertNull(exception.getMessage());
+        assertNull(exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.RequestException#RequestException(java.lang.String)}.
+     */
+    @Test
+    public void testRequestExceptionString() {
+        RequestException exception = new RequestException("my message");
+        assertEquals("my message", exception.getMessage());
+        assertNull(exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.RequestException#RequestException(java.lang.Throwable)}.
+     */
+    @Test
+    public void testRequestExceptionThrowable() {
+        Throwable cause = new Throwable();
+        RequestException exception = new RequestException(cause);
+        assertEquals(cause.toString(), exception.getMessage());
+        assertEquals(cause, exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.RequestException#RequestException(java.lang.String, java.lang.Throwable)}.
+     */
+    @Test
+    public void testRequestExceptionStringThrowable() {
+        Throwable cause = new Throwable();
+        RequestException exception = new RequestException("my message", cause);
+        assertEquals("my message", exception.getMessage());
+        assertEquals(cause, exception.getCause());
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/RequestExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/RequestExceptionTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/NoSuchScopeExceptionTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/NoSuchScopeExceptionTest.java?rev=933750&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/NoSuchScopeExceptionTest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/NoSuchScopeExceptionTest.java Tue Apr 13 19:16:06 2010
@@ -0,0 +1,77 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tiles.request.scope;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * Tests {@link NoSuchScopeException}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoSuchScopeExceptionTest {
+
+    /**
+     * Test method for {@link org.apache.tiles.request.scope.NoSuchScopeException#NoSuchScopeException()}.
+     */
+    @Test
+    public void testNoSuchScopeException() {
+        NoSuchScopeException exception = new NoSuchScopeException();
+        assertNull(exception.getMessage());
+        assertNull(exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.scope.NoSuchScopeException#NoSuchScopeException(java.lang.String)}.
+     */
+    @Test
+    public void testNoSuchScopeExceptionString() {
+        NoSuchScopeException exception = new NoSuchScopeException("my message");
+        assertEquals("my message", exception.getMessage());
+        assertNull(exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.scope.NoSuchScopeException#NoSuchScopeException(java.lang.Throwable)}.
+     */
+    @Test
+    public void testNoSuchScopeExceptionThrowable() {
+        Throwable cause = new Throwable();
+        NoSuchScopeException exception = new NoSuchScopeException(cause);
+        assertEquals(cause.toString(), exception.getMessage());
+        assertEquals(cause, exception.getCause());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.scope.NoSuchScopeException#NoSuchScopeException(java.lang.String, java.lang.Throwable)}.
+     */
+    @Test
+    public void testNoSuchScopeExceptionStringThrowable() {
+        Throwable cause = new Throwable();
+        NoSuchScopeException exception = new NoSuchScopeException("my message", cause);
+        assertEquals("my message", exception.getMessage());
+        assertEquals(cause, exception.getCause());
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/NoSuchScopeExceptionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/NoSuchScopeExceptionTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/ReflectionContextResolverTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/ReflectionContextResolverTest.java?rev=933750&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/ReflectionContextResolverTest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/ReflectionContextResolverTest.java Tue Apr 13 19:16:06 2010
@@ -0,0 +1,187 @@
+/**
+ *
+ */
+package org.apache.tiles.request.scope;
+
+import static org.junit.Assert.*;
+import static org.easymock.EasyMock.*;
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.Request;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests {@link ReflectionContextResolver}
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReflectionContextResolverTest {
+
+    private static final String [] SCOPES = new String[] {"one", "two", "three"};
+
+    private ReflectionContextResolver resolver;
+
+    private Map<String, Object> oneScope;
+    private Map<String, Object> twoScope;
+    private Map<String, Object> threeScope;
+
+    private Request request;
+
+    /**
+     * Initializes the test.
+     */
+    @SuppressWarnings("unchecked")
+    @Before
+    public void setUp() {
+        resolver = new ReflectionContextResolver();
+        oneScope = createMock(Map.class);
+        twoScope = createMock(Map.class);
+        threeScope = createMock(Map.class);
+        request = new SampleRequest(oneScope, twoScope, threeScope);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.scope.ReflectionContextResolver#getContext(org.apache.tiles.request.Request, java.lang.String)}.
+     */
+    @Test
+    public void testGetContext() {
+        replay(oneScope, twoScope, threeScope);
+        assertEquals(oneScope, resolver.getContext(request, "one"));
+        assertEquals(twoScope, resolver.getContext(request, "two"));
+        assertEquals(threeScope, resolver.getContext(request, "three"));
+        verify(oneScope, twoScope, threeScope);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.scope.ReflectionContextResolver#getAvailableScopes(org.apache.tiles.request.Request)}.
+     */
+    @Test
+    public void testGetAvailableScopes() {
+        replay(oneScope, twoScope, threeScope);
+        assertArrayEquals(SCOPES, resolver.getAvailableScopes(request));
+        verify(oneScope, twoScope, threeScope);
+    }
+
+    public static class SampleRequest implements Request {
+
+        private static final String [] SCOPES = new String[] {"one", "two", "three"};
+
+        private Map<String, Object> oneScope, twoScope, threeScope;
+
+        public SampleRequest(Map<String, Object> oneScope,
+                Map<String, Object> twoScope, Map<String, Object> threeScope) {
+            this.oneScope = oneScope;
+            this.twoScope = twoScope;
+            this.threeScope = threeScope;
+        }
+
+        @Override
+        public String[] getNativeScopes() {
+            return SCOPES;
+        }
+
+        @Override
+        public String[] getAvailableScopes() {
+            return SCOPES;
+        }
+
+        public Map<String, Object> getOneScope() {
+            return oneScope;
+        }
+
+        public Map<String, Object> getTwoScope() {
+            return twoScope;
+        }
+
+        public Map<String, Object> getThreeScope() {
+            return threeScope;
+        }
+
+        @Override
+        public void dispatch(String path) {
+            // Does nothing.
+        }
+
+        @Override
+        public ApplicationContext getApplicationContext() {
+            return null;
+        }
+
+        @Override
+        public Map<String, Object> getContext(String scope) {
+            return null;
+        }
+
+        @Override
+        public Map<String, String> getHeader() {
+            return null;
+        }
+
+        @Override
+        public Map<String, String[]> getHeaderValues() {
+            return null;
+        }
+
+        @Override
+        public OutputStream getOutputStream() {
+            return null;
+        }
+
+        @Override
+        public Map<String, String> getParam() {
+            return null;
+        }
+
+        @Override
+        public Map<String, String[]> getParamValues() {
+            return null;
+        }
+
+        @Override
+        public PrintWriter getPrintWriter() {
+            return null;
+        }
+
+        @Override
+        public Locale getRequestLocale() {
+            return null;
+        }
+
+        @Override
+        public Object[] getRequestObjects() {
+            return null;
+        }
+
+        @Override
+        public Writer getWriter() {
+            return null;
+        }
+
+        @Override
+        public void include(String path) {
+            // Does nothing.
+        }
+
+        @Override
+        public boolean isResponseCommitted() {
+            return false;
+        }
+
+        @Override
+        public boolean isUserInRole(String role) {
+            return false;
+        }
+
+        @Override
+        public void setContentType(String contentType) {
+            // Does nothing.
+        }
+    }
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/ReflectionContextResolverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/scope/ReflectionContextResolverTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationAccessTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationAccessTest.java?rev=933750&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationAccessTest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationAccessTest.java Tue Apr 13 19:16:06 2010
@@ -0,0 +1,78 @@
+/**
+ *
+ */
+package org.apache.tiles.request.util;
+
+import static org.junit.Assert.*;
+import static org.easymock.EasyMock.*;
+
+import java.util.Map;
+
+import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.scope.ContextResolver;
+import org.junit.Test;
+
+/**
+ * Tests {@link ApplicationAccess}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ApplicationAccessTest {
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationAccess#register(org.apache.tiles.request.ApplicationContext)}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testRegister() {
+        ApplicationContext applicationContext = createMock(ApplicationContext.class);
+        Map<String, Object> applicationScope = createMock(Map.class);
+
+        expect(applicationContext.getApplicationScope()).andReturn(applicationScope);
+        expect(applicationScope.put(ApplicationAccess
+                .APPLICATION_CONTEXT_ATTRIBUTE, applicationContext)).andReturn(null);
+
+        replay(applicationContext, applicationScope);
+        ApplicationAccess.register(applicationContext);
+        verify(applicationContext, applicationScope);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationAccess#registerContextResolver(org.apache.tiles.request.scope.ContextResolver, org.apache.tiles.request.ApplicationContext)}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testRegisterContextResolver() {
+        ApplicationContext applicationContext = createMock(ApplicationContext.class);
+        Map<String, Object> applicationScope = createMock(Map.class);
+        ContextResolver contextResolver = createMock(ContextResolver.class);
+
+        expect(applicationContext.getApplicationScope()).andReturn(applicationScope);
+        expect(applicationScope.put(ApplicationAccess
+                .CONTEXT_RESOLVER_ATTRIBUTE, contextResolver)).andReturn(null);
+
+        replay(applicationContext, applicationScope, contextResolver);
+        ApplicationAccess.registerContextResolver(contextResolver, applicationContext);
+        verify(applicationContext, applicationScope, contextResolver);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationAccess#getContextResolver(org.apache.tiles.request.ApplicationContext)}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetContextResolver() {
+        ApplicationContext applicationContext = createMock(ApplicationContext.class);
+        Map<String, Object> applicationScope = createMock(Map.class);
+        ContextResolver contextResolver = createMock(ContextResolver.class);
+
+        expect(applicationContext.getApplicationScope()).andReturn(applicationScope);
+        expect(applicationScope.get(ApplicationAccess
+                .CONTEXT_RESOLVER_ATTRIBUTE)).andReturn(contextResolver);
+
+        replay(applicationContext, applicationScope, contextResolver);
+        assertEquals(contextResolver, ApplicationAccess.getContextResolver(applicationContext));
+        verify(applicationContext, applicationScope, contextResolver);
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationAccessTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationAccessTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationContextWrapperTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationContextWrapperTest.java?rev=933750&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationContextWrapperTest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationContextWrapperTest.java Tue Apr 13 19:16:06 2010
@@ -0,0 +1,123 @@
+/**
+ *
+ */
+package org.apache.tiles.request.util;
+
+import static org.easymock.EasyMock.*;
+import static org.easymock.classextension.EasyMock.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tiles.request.ApplicationContext;
+import org.junit.Test;
+
+/**
+ * Tests {@link ApplicationContextWrapper}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ApplicationContextWrapperTest {
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationContextWrapper#getWrappedApplicationContext()}.
+     */
+    @Test
+    public void testGetWrappedApplicationContext() {
+        ApplicationContext wrappedContext = createMock(ApplicationContext.class);
+
+        replay(wrappedContext);
+        ApplicationContextWrapper wrapper = new ApplicationContextWrapper(wrappedContext);
+        assertEquals(wrappedContext, wrapper.getWrappedApplicationContext());
+        verify(wrappedContext);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationContextWrapper#getApplicationScope()}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetApplicationScope() {
+        ApplicationContext wrappedContext = createMock(ApplicationContext.class);
+        Map<String, Object> applicationScope = createMock(Map.class);
+
+        expect(wrappedContext.getApplicationScope()).andReturn(applicationScope);
+
+        replay(wrappedContext, applicationScope);
+        ApplicationContextWrapper wrapper = new ApplicationContextWrapper(wrappedContext);
+        assertEquals(applicationScope, wrapper.getApplicationScope());
+        verify(wrappedContext, applicationScope);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationContextWrapper#getContext()}.
+     */
+    @Test
+    public void testGetContext() {
+        ApplicationContext wrappedContext = createMock(ApplicationContext.class);
+        Object obj = createMock(Object.class);
+
+        expect(wrappedContext.getContext()).andReturn(obj);
+
+        replay(wrappedContext, obj);
+        ApplicationContextWrapper wrapper = new ApplicationContextWrapper(wrappedContext);
+        assertEquals(obj, wrapper.getContext());
+        verify(wrappedContext, obj);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationContextWrapper#getInitParams()}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetInitParams() {
+        ApplicationContext wrappedContext = createMock(ApplicationContext.class);
+        Map<String, String> obj = createMock(Map.class);
+
+        expect(wrappedContext.getInitParams()).andReturn(obj);
+
+        replay(wrappedContext, obj);
+        ApplicationContextWrapper wrapper = new ApplicationContextWrapper(wrappedContext);
+        assertEquals(obj, wrapper.getInitParams());
+        verify(wrappedContext, obj);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationContextWrapper#getResource(java.lang.String)}.
+     * @throws IOException If something goes wrong.
+     */
+    @Test
+    public void testGetResource() throws IOException {
+        ApplicationContext wrappedContext = createMock(ApplicationContext.class);
+        URL obj = new URL("file:///home/neverland/whatever.html");
+
+        expect(wrappedContext.getResource("whatever.html")).andReturn(obj);
+
+        replay(wrappedContext);
+        ApplicationContextWrapper wrapper = new ApplicationContextWrapper(wrappedContext);
+        assertEquals(obj, wrapper.getResource("whatever.html"));
+        verify(wrappedContext);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.ApplicationContextWrapper#getResources(java.lang.String)}.
+     * @throws IOException If something goes wrong.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetResources() throws IOException {
+        ApplicationContext wrappedContext = createMock(ApplicationContext.class);
+        Set<URL> obj = createMock(Set.class);
+
+        expect(wrappedContext.getResources("whatever.html")).andReturn(obj);
+
+        replay(wrappedContext, obj);
+        ApplicationContextWrapper wrapper = new ApplicationContextWrapper(wrappedContext);
+        assertEquals(obj, wrapper.getResources("whatever.html"));
+        verify(wrappedContext, obj);
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationContextWrapperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/ApplicationContextWrapperTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/MapEntryTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/MapEntryTest.java?rev=933750&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/MapEntryTest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/MapEntryTest.java Tue Apr 13 19:16:06 2010
@@ -0,0 +1,93 @@
+/**
+ *
+ */
+package org.apache.tiles.request.util;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * Tests {@link MapEntry}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MapEntryTest {
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.MapEntry#hashCode()}.
+     */
+    @Test
+    public void testHashCode() {
+        MapEntry<String, String> entry = new MapEntry<String, String>("key", "value", false);
+        assertEquals("key".hashCode() ^ "value".hashCode(), entry.hashCode());
+        entry = new MapEntry<String, String>(null, "value", false);
+        assertEquals(0 ^ "value".hashCode(), entry.hashCode());
+        entry = new MapEntry<String, String>("key", null, false);
+        assertEquals("key".hashCode() ^ 0, entry.hashCode());
+        entry = new MapEntry<String, String>(null, null, false);
+        assertEquals(0 ^ 0, entry.hashCode());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.MapEntry#getKey()}.
+     */
+    @Test
+    public void testGetKey() {
+        MapEntry<String, String> entry = new MapEntry<String, String>("key", "value", false);
+        assertEquals("key", entry.getKey());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.MapEntry#getValue()}.
+     */
+    @Test
+    public void testGetValue() {
+        MapEntry<String, String> entry = new MapEntry<String, String>("key", "value", false);
+        assertEquals("value", entry.getValue());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.MapEntry#setValue(java.lang.Object)}.
+     */
+    @Test
+    public void testSetValue() {
+        MapEntry<String, String> entry = new MapEntry<String, String>("key", "value", true);
+        assertEquals("value", entry.getValue());
+        entry.setValue("value2");
+        assertEquals("value2", entry.getValue());
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.MapEntry#setValue(java.lang.Object)}.
+     */
+    @Test(expected=UnsupportedOperationException.class)
+    public void testSetValueException() {
+        MapEntry<String, String> entry = new MapEntry<String, String>("key", "value", false);
+        assertEquals("value", entry.getValue());
+        entry.setValue("value2");
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.MapEntry#equals(java.lang.Object)}.
+     */
+    @Test
+    public void testEqualsObject() {
+        MapEntry<String, String> entry = new MapEntry<String, String>("key", "value", false);
+        assertFalse(entry.equals(null));
+        assertFalse(entry.equals("whatever"));
+        MapEntry<String, String> entry2 = new MapEntry<String, String>("key", "value", false);
+        assertTrue(entry.equals(entry2));
+        entry2 = new MapEntry<String, String>("key2", "value", false);
+        assertFalse(entry.equals(entry2));
+        entry2 = new MapEntry<String, String>("key", "value2", false);
+        assertFalse(entry.equals(entry2));
+        entry = new MapEntry<String, String>(null, "value", false);
+        entry2 = new MapEntry<String, String>(null, "value", false);
+        assertTrue(entry.equals(entry));
+        entry = new MapEntry<String, String>("key", null, false);
+        entry2 = new MapEntry<String, String>("key", null, false);
+        assertTrue(entry.equals(entry));
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/MapEntryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/MapEntryTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/RequestWrapperTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/RequestWrapperTest.java?rev=933750&view=auto
==============================================================================
--- tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/RequestWrapperTest.java (added)
+++ tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/RequestWrapperTest.java Tue Apr 13 19:16:06 2010
@@ -0,0 +1,348 @@
+/**
+ *
+ */
+package org.apache.tiles.request.util;
+
+import static org.easymock.EasyMock.*;
+import static org.easymock.classextension.EasyMock.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.Writer;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.tiles.request.ApplicationContext;
+import org.apache.tiles.request.Request;
+import org.apache.tiles.request.scope.ContextResolver;
+import org.junit.Test;
+
+/**
+ * Tests {@link RequestWrapper}.
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestWrapperTest {
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getWrappedRequest()}.
+     */
+    @Test
+    public void testGetWrappedRequest() {
+        Request wrappedRequest = createMock(Request.class);
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(wrappedRequest, request.getWrappedRequest());
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getHeader()}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetHeader() {
+        Request wrappedRequest = createMock(Request.class);
+        Map<String, String> header = createMock(Map.class);
+
+        expect(wrappedRequest.getHeader()).andReturn(header);
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(header, request.getHeader());
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getHeaderValues()}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetHeaderValues() {
+        Request wrappedRequest = createMock(Request.class);
+        Map<String, String[]> header = createMock(Map.class);
+
+        expect(wrappedRequest.getHeaderValues()).andReturn(header);
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(header, request.getHeaderValues());
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getContext(java.lang.String)}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetContext() {
+        Request wrappedRequest = createMock(Request.class);
+        Map<String, Object> context = createMock(Map.class);
+        ApplicationContext applicationContext = createMock(ApplicationContext.class);
+        ContextResolver resolver = createMock(ContextResolver.class);
+        Map<String, Object> applicationScope = createMock(Map.class);
+
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+
+        expect(wrappedRequest.getApplicationContext()).andReturn(applicationContext);
+        expect(applicationContext.getApplicationScope()).andReturn(applicationScope);
+        expect(applicationScope.get(ApplicationAccess.CONTEXT_RESOLVER_ATTRIBUTE)).andReturn(resolver);
+        expect(resolver.getContext(request, "one")).andReturn(context);
+
+        replay(wrappedRequest, context, applicationContext, resolver, applicationScope);
+        assertEquals(context, request.getContext("one"));
+        verify(wrappedRequest, context, applicationContext, resolver, applicationScope);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getNativeScopes()}.
+     */
+    @Test
+    public void testGetNativeScopes() {
+        Request wrappedRequest = createMock(Request.class);
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertNull(request.getNativeScopes());
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getAvailableScopes()}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetAvailableScopes() {
+        Request wrappedRequest = createMock(Request.class);
+        Map<String, Object> context = createMock(Map.class);
+        ApplicationContext applicationContext = createMock(ApplicationContext.class);
+        ContextResolver resolver = createMock(ContextResolver.class);
+        Map<String, Object> applicationScope = createMock(Map.class);
+
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+
+        expect(wrappedRequest.getApplicationContext()).andReturn(applicationContext);
+        expect(applicationContext.getApplicationScope()).andReturn(applicationScope);
+        expect(applicationScope.get(ApplicationAccess.CONTEXT_RESOLVER_ATTRIBUTE)).andReturn(resolver);
+        String[] scopes = new String[] {"one", "two", "three"};
+        expect(resolver.getAvailableScopes(request)).andReturn(scopes);
+
+        replay(wrappedRequest, context, applicationContext, resolver, applicationScope);
+        assertArrayEquals(scopes, request.getAvailableScopes());
+        verify(wrappedRequest, context, applicationContext, resolver, applicationScope);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getApplicationContext()}.
+     */
+    @Test
+    public void testGetApplicationContext() {
+        Request wrappedRequest = createMock(Request.class);
+        ApplicationContext applicationContext = createMock(ApplicationContext.class);
+
+        expect(wrappedRequest.getApplicationContext()).andReturn(applicationContext);
+
+        replay(wrappedRequest, applicationContext);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(applicationContext, request.getApplicationContext());
+        verify(wrappedRequest, applicationContext);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#dispatch(java.lang.String)}.
+     * @throws IOException If something goes wrong.
+     */
+    @Test
+    public void testDispatch() throws IOException {
+        Request wrappedRequest = createMock(Request.class);
+
+        wrappedRequest.dispatch("/my/path.html");
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        request.dispatch("/my/path.html");
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#include(java.lang.String)}.
+     * @throws IOException If something goes wrong.
+     */
+    @Test
+    public void testInclude() throws IOException {
+        Request wrappedRequest = createMock(Request.class);
+
+        wrappedRequest.include("/my/path.html");
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        request.include("/my/path.html");
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getOutputStream()}.
+     * @throws IOException If something goes wrong.
+     */
+    @Test
+    public void testGetOutputStream() throws IOException {
+        Request wrappedRequest = createMock(Request.class);
+        OutputStream stream = createMock(OutputStream.class);
+
+        expect(wrappedRequest.getOutputStream()).andReturn(stream);
+
+        replay(wrappedRequest, stream);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(stream, request.getOutputStream());
+        verify(wrappedRequest, stream);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getWriter()}.
+     * @throws IOException If something goes wrong.
+     */
+    @Test
+    public void testGetWriter() throws IOException {
+        Request wrappedRequest = createMock(Request.class);
+        Writer writer = createMock(Writer.class);
+
+        expect(wrappedRequest.getWriter()).andReturn(writer);
+
+        replay(wrappedRequest, writer);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(writer, request.getWriter());
+        verify(wrappedRequest, writer);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getPrintWriter()}.
+     * @throws IOException If something goes wrong.
+     */
+    @Test
+    public void testGetPrintWriter() throws IOException {
+        Request wrappedRequest = createMock(Request.class);
+        PrintWriter writer = createMock(PrintWriter.class);
+
+        expect(wrappedRequest.getPrintWriter()).andReturn(writer);
+
+        replay(wrappedRequest, writer);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(writer, request.getPrintWriter());
+        verify(wrappedRequest, writer);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#isResponseCommitted()}.
+     */
+    @Test
+    public void testIsResponseCommitted() {
+        Request wrappedRequest = createMock(Request.class);
+
+        expect(wrappedRequest.isResponseCommitted()).andReturn(Boolean.TRUE);
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertTrue(request.isResponseCommitted());
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#setContentType(java.lang.String)}.
+     */
+    @Test
+    public void testSetContentType() {
+        Request wrappedRequest = createMock(Request.class);
+
+        wrappedRequest.setContentType("text/html");
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        request.setContentType("text/html");
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getParam()}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetParam() {
+        Request wrappedRequest = createMock(Request.class);
+        Map<String, String> param = createMock(Map.class);
+
+        expect(wrappedRequest.getParam()).andReturn(param);
+
+        replay(wrappedRequest, param);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(param, request.getParam());
+        verify(wrappedRequest, param);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getParamValues()}.
+     */
+    @SuppressWarnings("unchecked")
+    @Test
+    public void testGetParamValues() {
+        Request wrappedRequest = createMock(Request.class);
+        Map<String, String[]> param = createMock(Map.class);
+
+        expect(wrappedRequest.getParamValues()).andReturn(param);
+
+        replay(wrappedRequest, param);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(param, request.getParamValues());
+        verify(wrappedRequest, param);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getRequestLocale()}.
+     */
+    @Test
+    public void testGetRequestLocale() {
+        Request wrappedRequest = createMock(Request.class);
+        Locale param = Locale.ITALY;
+
+        expect(wrappedRequest.getRequestLocale()).andReturn(param);
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertEquals(param, request.getRequestLocale());
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#isUserInRole(java.lang.String)}.
+     */
+    @Test
+    public void testIsUserInRole() {
+        Request wrappedRequest = createMock(Request.class);
+
+        expect(wrappedRequest.isUserInRole("myrole")).andReturn(Boolean.TRUE);
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertTrue(request.isUserInRole("myrole"));
+        verify(wrappedRequest);
+    }
+
+    /**
+     * Test method for {@link org.apache.tiles.request.util.RequestWrapper#getRequestObjects()}.
+     */
+    @Test
+    public void testGetRequestObjects() {
+        Request wrappedRequest = createMock(Request.class);
+        String[] param = new String[] {"one", "two", "three"};
+
+        expect(wrappedRequest.getRequestObjects()).andReturn(param);
+
+        replay(wrappedRequest);
+        RequestWrapper request = new RequestWrapper(wrappedRequest);
+        assertArrayEquals(param, request.getRequestObjects());
+        verify(wrappedRequest);
+    }
+
+}

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/RequestWrapperTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/sandbox/trunk/tiles-request/tiles-request-api/src/test/java/org/apache/tiles/request/util/RequestWrapperTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message