mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-26 22:02:41 +00:00
Tidying stuff
This commit is contained in:
parent
fa630a430d
commit
3261fcb174
@ -30,7 +30,6 @@ public class WebExpressionVoter implements AccessDecisionVoter {
|
|||||||
FilterInvocation fi = (FilterInvocation)object;
|
FilterInvocation fi = (FilterInvocation)object;
|
||||||
EvaluationContext ctx = expressionHandler.createEvaluationContext(authentication, fi);
|
EvaluationContext ctx = expressionHandler.createEvaluationContext(authentication, fi);
|
||||||
|
|
||||||
|
|
||||||
weca.getAuthorizeExpression();
|
weca.getAuthorizeExpression();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -17,7 +17,6 @@ package sample.contact;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@ -52,13 +51,8 @@ public class GetAllContactsTests {
|
|||||||
|
|
||||||
//~ Methods ========================================================================================================
|
//~ Methods ========================================================================================================
|
||||||
|
|
||||||
protected void assertContainsContact(String id, List contacts) {
|
protected void assertContainsContact(String id, List<Contact> contacts) {
|
||||||
Iterator iter = contacts.iterator();
|
for(Contact contact : contacts) {
|
||||||
System.out.println(contacts);
|
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Contact contact = (Contact) iter.next();
|
|
||||||
|
|
||||||
if (contact.getId().toString().equals(id)) {
|
if (contact.getId().toString().equals(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -67,13 +61,9 @@ public class GetAllContactsTests {
|
|||||||
fail("List of contacts should have contained: " + id);
|
fail("List of contacts should have contained: " + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertDoestNotContainContact(String id, List contacts) {
|
void assertDoestNotContainContact(String id, List<Contact> contacts) {
|
||||||
Iterator iter = contacts.iterator();
|
for(Contact contact : contacts) {
|
||||||
|
if (contact.getId().toString().equals(id)) {
|
||||||
while (iter.hasNext()) {
|
|
||||||
Contact domain = (Contact) iter.next();
|
|
||||||
|
|
||||||
if (domain.getId().toString().equals(id)) {
|
|
||||||
fail("List of contact should NOT (but did) contain: " + id);
|
fail("List of contact should NOT (but did) contain: " + id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,12 +78,7 @@ public class GetAllContactsTests {
|
|||||||
* @return the domain or <code>null</code> if not found
|
* @return the domain or <code>null</code> if not found
|
||||||
*/
|
*/
|
||||||
protected Contact getContact(String id) {
|
protected Contact getContact(String id) {
|
||||||
List contacts = contactManager.getAll();
|
for(Contact contact : contactManager.getAll()) {
|
||||||
Iterator iter = contacts.iterator();
|
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Contact contact = (Contact) iter.next();
|
|
||||||
|
|
||||||
if (contact.getId().equals(id)) {
|
if (contact.getId().equals(id)) {
|
||||||
return contact;
|
return contact;
|
||||||
}
|
}
|
||||||
@ -128,7 +113,7 @@ public class GetAllContactsTests {
|
|||||||
public void testDianne() {
|
public void testDianne() {
|
||||||
makeActiveUser("dianne"); // has ROLE_USER
|
makeActiveUser("dianne"); // has ROLE_USER
|
||||||
|
|
||||||
List contacts = contactManager.getAll();
|
List<Contact> contacts = contactManager.getAll();
|
||||||
assertEquals(4, contacts.size());
|
assertEquals(4, contacts.size());
|
||||||
|
|
||||||
assertContainsContact(Long.toString(4), contacts);
|
assertContainsContact(Long.toString(4), contacts);
|
||||||
@ -145,7 +130,7 @@ public class GetAllContactsTests {
|
|||||||
public void testrod() {
|
public void testrod() {
|
||||||
makeActiveUser("rod"); // has ROLE_SUPERVISOR
|
makeActiveUser("rod"); // has ROLE_SUPERVISOR
|
||||||
|
|
||||||
List contacts = contactManager.getAll();
|
List<Contact> contacts = contactManager.getAll();
|
||||||
|
|
||||||
assertEquals(4, contacts.size());
|
assertEquals(4, contacts.size());
|
||||||
|
|
||||||
@ -165,7 +150,7 @@ public class GetAllContactsTests {
|
|||||||
public void testScott() {
|
public void testScott() {
|
||||||
makeActiveUser("scott"); // has ROLE_USER
|
makeActiveUser("scott"); // has ROLE_USER
|
||||||
|
|
||||||
List contacts = contactManager.getAll();
|
List<Contact> contacts = contactManager.getAll();
|
||||||
|
|
||||||
assertEquals(5, contacts.size());
|
assertEquals(5, contacts.size());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user