PrivilegeManagementServiceImpl implements PrivilegeManagementService { private BaseSubject createSubject(final String subjectIdentifier, final ZoneEntity zone, final SubjectEntity subjectEntity) { BaseSubject subject = this.privilegeConverter.toSubject(subjectEntity); if (subject == null) { LOGGER.debug("Unable to find the subject for subjectIdentifier = {}, zone = {}.", subjectIdentifier, zone); } return subject; }  @Override void appendResources(final List<BaseResource> resources); @Override @Transactional(readOnly = true) List<BaseResource> getResources(); @Override @Transactional(readOnly = true) BaseResource getByResourceIdentifier(final String resourceIdentifier); @Override @Transactional(readOnly = true) BaseResource getByResourceIdentifierWithInheritedAttributes(final String resourceIdentifier); @Override boolean upsertResource(final BaseResource resource); @Override @Transactional boolean deleteResource(final String resourceIdentifier); @Override void appendSubjects(final List<BaseSubject> subjects); @Override @Transactional(readOnly = true) List<BaseSubject> getSubjects(); @Override @Transactional(readOnly = true) BaseSubject getBySubjectIdentifier(final String subjectIdentifier); @Override @Transactional(readOnly = true) BaseSubject getBySubjectIdentifierWithInheritedAttributes(final String subjectIdentifier); @Override @Transactional(readOnly = true) BaseSubject getBySubjectIdentifierAndScopes(final String subjectIdentifier, final Set<Attribute> scopes); @Override boolean upsertSubject(final BaseSubject subject); @Override @Transactional boolean deleteSubject(final String subjectIdentifier); void setCache(final PolicyEvaluationCache cache);  }
@Test public void testCreateSubject() { String subjectIdentifier = "marissa"; try { BaseSubject subject = createSubject(subjectIdentifier, this.fixedAttributes); boolean created = this.service.upsertSubject(subject); Assert.assertTrue(created); Assert.assertTrue(this.service.getBySubjectIdentifier(subjectIdentifier).equals(subject)); } finally { this.service.deleteSubject("marissa"); } }