Roles { public static String valueOf(Role role) { if (role instanceof TenantRole) return valueOf((TenantRole) role); if (role instanceof ApplicationRole) return valueOf((ApplicationRole) role); throw new IllegalArgumentException("Unexpected role type '" + role.getClass().getName() + "'."); } private  Roles(); static List<TenantRole> tenantRoles(TenantName tenant); static List<ApplicationRole> applicationRoles(TenantName tenant, ApplicationName application); static Role toRole(String value); static Role toRole(TenantName tenant, String roleName); static Role toRole(TenantName tenant, ApplicationName application, String roleName); static String valueOf(Role role);  }
@Test(expected = IllegalArgumentException.class) public void illegalTenantName() { Roles.valueOf(Role.developer(TenantName.from("my.tenant"))); }
@Test(expected = IllegalArgumentException.class) public void illegalApplicationName() { Roles.valueOf(Role.headless(TenantName.from("my-tenant"), ApplicationName.from("my.app"))); }