Author: apetrelli
Date: Fri Jul 13 12:01:23 2007
New Revision: 556108
URL: http://svn.apache.org/viewvc?view=rev&rev=556108
Log:
TILES-185
Fixed test class to follow checkstyle rules.
Modified:
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java
Modified:
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java?view=diff&rev=556108&r1=556107&r2=556108
==============================================================================
---
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java
(original)
+++
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/impl/BasicTilesContainerTest.java
Fri Jul 13 12:01:23 2007
@@ -127,7 +127,13 @@
assertTrue("An attribute of 'object' type cannot be rendered",
exceptionFound);
}
-
+
+ /**
+ * Tests is attributes are rendered correctly according to users roles.
+ *
+ * @throws TilesException If a problem arises during rendering.
+ * @throws IOException If a problem arises during rendering or writing in
the writer.
+ */
public void testAttributeCredentials() throws TilesException, IOException {
RoleMockHttpServletRequest request = new
RoleMockHttpServletRequest("myrole");
MockHttpSession session = new MockHttpSession();
@@ -146,22 +152,33 @@
assertNotSame("The attribute should have not been rendered", writer
.toString(), "This is the value");
}
-
+
+ /**
+ * Servlet request mock class that allows to choose the user roles.
+ */
private static class RoleMockHttpServletRequest extends
MockHttpServletRequest {
-
+
+ /**
+ * Set containing the allowed roles.
+ */
private Set<String> roleSet;
-
+
+ /**
+ * Constructor.
+ *
+ * @param roles The roles to be allowed.
+ */
public RoleMockHttpServletRequest(String... roles) {
roleSet = new HashSet<String>();
- for (String role: roles) {
+ for (String role : roles) {
roleSet.add(role);
}
}
+ /** [EMAIL PROTECTED] */
@Override
public boolean isUserInRole(String role) {
return roleSet.contains(role);
}
-
}
}