TrustedApplicationUserBuilder implements ApplicationUserBuilder { @Override public ApplicationUser buildNoRoles(HttpServletRequest request) { return buildUser(request, false); }  @Override ApplicationUser build(HttpServletRequest request); @Override ApplicationUser buildNoRoles(HttpServletRequest request); static final String TRUSTED_USER_ID; static final String TRUSTED_USER_FIRST_NAME; static final String TRUSTED_USER_LAST_NAME; static final String TRUSTED_USER_EMAIL; static final String TRUSTED_USER_ROLE; }
@Test public void testTrustedUserBuilderNoRoles() throws Exception { Set<NamespaceAuthorization> namespaceAuthorizations = new LinkedHashSet<>(); namespaceAuthorizations.add(new NamespaceAuthorization(NAMESPACE, SUPPORTED_NAMESPACE_PERMISSIONS)); namespaceAuthorizations.add(new NamespaceAuthorization(NAMESPACE_2, SUPPORTED_NAMESPACE_PERMISSIONS)); userNamespaceAuthorizationDaoTestHelper .createUserNamespaceAuthorizationEntity(TrustedApplicationUserBuilder.TRUSTED_USER_ID, namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE), SUPPORTED_NAMESPACE_PERMISSIONS); userNamespaceAuthorizationDaoTestHelper .createUserNamespaceAuthorizationEntity(TrustedApplicationUserBuilder.TRUSTED_USER_ID, namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE_2), SUPPORTED_NAMESPACE_PERMISSIONS); ApplicationUser applicationUser = trustedApplicationUserBuilder.buildNoRoles(new MockHttpServletRequest()); assertEquals(TrustedApplicationUserBuilder.TRUSTED_USER_ID, applicationUser.getUserId()); assertEquals(TrustedApplicationUserBuilder.TRUSTED_USER_FIRST_NAME, applicationUser.getFirstName()); assertEquals(TrustedApplicationUserBuilder.TRUSTED_USER_LAST_NAME, applicationUser.getLastName()); assertEquals(TrustedApplicationUserBuilder.TRUSTED_USER_EMAIL, applicationUser.getEmail()); assertEquals(namespaceAuthorizations, applicationUser.getNamespaceAuthorizations()); assertEquals(0, applicationUser.getRoles().size()); }