MYFACESTEST-65 Implement HttpServletRequest.isUserInRole(String)
diff --git a/test12/src/main/java/org/apache/myfaces/test/mock/MockHttpServletRequest.java b/test12/src/main/java/org/apache/myfaces/test/mock/MockHttpServletRequest.java
index 5d6b41e..eedfab5 100644
--- a/test12/src/main/java/org/apache/myfaces/test/mock/MockHttpServletRequest.java
+++ b/test12/src/main/java/org/apache/myfaces/test/mock/MockHttpServletRequest.java
@@ -294,6 +294,24 @@
{
this.servletPath = servletPath;
}
+
+ public void addUserRole(String role)
+ {
+ if (this.roles == null)
+ {
+ this.roles = new ArrayList<String>();
+ }
+ this.roles.add(role);
+ }
+
+ public void clearUserRoles()
+ {
+ if (this.roles == null)
+ {
+ return;
+ }
+ this.roles.clear();
+ }
// ------------------------------------------------------ Instance Variables
@@ -314,6 +332,7 @@
private List cookies = new ArrayList();
private Vector locales = null;
private String method = null;
+ private List<String> roles = null;
// ---------------------------------------------- HttpServletRequest Methods
@@ -607,9 +626,7 @@
/** {@inheritDoc} */
public boolean isUserInRole(String role)
{
-
- throw new UnsupportedOperationException();
-
+ return (this.roles != null) ? this.roles.contains(role) : false;
}
// ------------------------------------------------- ServletRequest Methods