AthenzIdentities { public static AthenzIdentity from(AthenzDomain domain, String identityName) { if (domain.equals(USER_PRINCIPAL_DOMAIN)) { return AthenzUser.fromUserId(identityName); } else { return new AthenzService(domain, identityName); } } private  AthenzIdentities(); static AthenzIdentity from(AthenzDomain domain, String identityName); static AthenzIdentity from(String fullName); static AthenzIdentity from(X509Certificate certificate); static final AthenzDomain USER_PRINCIPAL_DOMAIN; static final AthenzService ZMS_ATHENZ_SERVICE; }
@Test public void athenz_identity_is_parsed_from_dot_separated_string() { AthenzIdentity expectedIdentity = new AthenzService(new AthenzDomain("my.subdomain"), "myservicename"); String fullName = expectedIdentity.getFullName(); AthenzIdentity actualIdentity = AthenzIdentities.from(fullName); assertEquals(expectedIdentity, actualIdentity); }