Set privateCredentials = new HashSet();
principals.add(new UserPrincipalImpl("user"));
principals.add(new RolePrincipalImpl("role"));
request.setSubject(new Subject(true, principals, publicCredentials, privateCredentials));
request.setLocale(new Locale("en", "US"));
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setServerName("www.domain.com");
request.setRequest(servletRequest);
try
{
ProfilingRule rule = profiler.getRule("subsite-by-hostname");
assertNotNull(rule);