@Test public void testCustomUser() { AuthenticatedUser user = AuthenticatedUserUtil.createFromString("Bob"); assertThat(user.getName()).isEqualTo("Bob"); assertThat(user.getPrimaryRole()).isEqualTo(RoleResource.role("Bob")); }
public static AuthenticatedUser createFromString(String user) { switch (user) { case AuthenticatedUser.SYSTEM_USERNAME: return AuthenticatedUser.SYSTEM_USER; case AuthenticatedUser.ANONYMOUS_USERNAME: return AuthenticatedUser.ANONYMOUS_USER; default: return new AuthenticatedUser(user); } }
AuthenticatedUserUtil { public static AuthenticatedUser createFromString(String user) { switch (user) { case AuthenticatedUser.SYSTEM_USERNAME: return AuthenticatedUser.SYSTEM_USER; case AuthenticatedUser.ANONYMOUS_USERNAME: return AuthenticatedUser.ANONYMOUS_USER; default: return new AuthenticatedUser(user); } } }
AuthenticatedUserUtil { public static AuthenticatedUser createFromString(String user) { switch (user) { case AuthenticatedUser.SYSTEM_USERNAME: return AuthenticatedUser.SYSTEM_USER; case AuthenticatedUser.ANONYMOUS_USERNAME: return AuthenticatedUser.ANONYMOUS_USER; default: return new AuthenticatedUser(user); } } private  AuthenticatedUserUtil(); }
AuthenticatedUserUtil { public static AuthenticatedUser createFromString(String user) { switch (user) { case AuthenticatedUser.SYSTEM_USERNAME: return AuthenticatedUser.SYSTEM_USER; case AuthenticatedUser.ANONYMOUS_USERNAME: return AuthenticatedUser.ANONYMOUS_USER; default: return new AuthenticatedUser(user); } } private  AuthenticatedUserUtil(); static AuthenticatedUser createFromString(String user); }
AuthenticatedUserUtil { public static AuthenticatedUser createFromString(String user) { switch (user) { case AuthenticatedUser.SYSTEM_USERNAME: return AuthenticatedUser.SYSTEM_USER; case AuthenticatedUser.ANONYMOUS_USERNAME: return AuthenticatedUser.ANONYMOUS_USER; default: return new AuthenticatedUser(user); } } private  AuthenticatedUserUtil(); static AuthenticatedUser createFromString(String user);  }