Methods Summary |
---|
protected void | setUp()
|
protected void | tearDown()
|
public void | testAttachingNoPolicyToAnyPolicyResultsInNoEffectivePolicy()
PolicySubject ps = new PolicySubject(subject, Policy.createEmptyPolicy());
Policy noPolicy = Policy.createNullPolicy();
ps.attach(noPolicy);
assertEquals(noPolicy, ps.getEffectivePolicy(merger));
|
public void | testAttachingNullPolicyThrowsIAE()
PolicySubject ps = new PolicySubject(subject, Policy.createNullPolicy());
try {
ps.attach(null);
fail("Attaching a 'null' policy to the policyt subject must throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// ok.
}
|
public void | testCreatePolicySubjectWithEmptyPolicyCollectionMustThrowIAE()
try {
Collection<Policy> c = new ArrayList<Policy>();
new PolicySubject(subject, c);
fail ("PolicySubject creation must throw IllegalArgumentException on empty policy collection");
} catch (IllegalArgumentException e) {
// ok.
}
|
public void | testCreatePolicySubjectWithNullPolicyCollcetionMustThrowIAE()
try {
Collection<Policy> c = null;
new PolicySubject(subject, c);
fail ("PolicySubject creation must throw IllegalArgumentException on 'null' policy collection");
} catch (IllegalArgumentException e) {
// ok.
}
|
public void | testCreatePolicySubjectWithNullPolicyMustThrowIAE()
try {
Policy p = null;
new PolicySubject(subject, p);
fail ("PolicySubject creation must throw IllegalArgumentException on 'null' policy");
} catch (IllegalArgumentException e) {
// ok.
}
|
public void | testCreatePolicySubjectWithNullSubjectMustThrowIAE()
try {
new PolicySubject(null, Policy.createNullPolicy());
fail ("PolicySubject creation must throw IllegalArgumentException on 'null' subject");
} catch (IllegalArgumentException e) {
// ok.
}
|
public void | testGetSubjectReturnsCorrectReference()
StringBuffer subject = new StringBuffer('a");
PolicySubject ps = new PolicySubject(subject, Policy.createNullPolicy());
subject.append('b");
assertEquals("Subject used in constructor must equal to subject returned from getter.", subject, ps.getSubject());
|
public void | testGetSubjectReturnsCorrectSubject()
PolicySubject ps = new PolicySubject(subject, Policy.createNullPolicy());
assertEquals("Subject used in constructor must equal to subject returned from getter.", subject, ps.getSubject());
|