assertNotNull("principal should have been created", principal);
Person person = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(expectedPrincipalName);
assertNotNull("person should have been created", person);
EntityDefault entity = idSvc.getEntityDefault(principal.getEntityId());
assertNotNull("entity should have been created", entity);
Map<String, String> criteria = new HashMap<String, String>();
criteria.put("entityId", entity.getEntityId());
Collection<EntityAffiliationBo> results = getBoSvc().findMatching(EntityAffiliationBo.class, criteria);
assertEquals("number of affiliations differ", 1, results.size());
EntityAffiliationBo affilBo = results.iterator().next();
assertNotNull("affiliation type code should not be null", affilBo.getAffiliationTypeCode());
assertEquals("affiliation code differs", expectedAffilCode, affilBo.getAffiliationTypeCode());