@Test public void testGetEntityByPrincipalName() { String principalName = "kuluser"; Entity info = identityService.getEntityByPrincipalName(principalName); assertNotNull("entity must not be null", info); assertNotNull("entity principals must not be null", info.getPrincipals()); assertEquals("entity must have exactly 1 principal", 1, info.getPrincipals().size()); for (Principal principalInfo : info.getPrincipals()) { assertEquals("Wrong principal name", principalName, principalInfo.getPrincipalName()); } assertTrue( "entity external identifiers must not be null", (info.getExternalIdentifiers() == null) || info.getExternalIdentifiers().isEmpty()); assertTrue( "entity residencies must not be null", (info.getResidencies() == null) || info.getResidencies().isEmpty()); }