#42 Add tests for OpinionChoiceVoter
This commit is contained in:
@@ -10,7 +10,7 @@ class OpinionChoiceVoter : Voter {
|
||||
|
||||
override fun supports(action: ActionI, call: ApplicationCall, subject: Any?): Boolean {
|
||||
return (action is Action)
|
||||
.and(subject is OpinionChoice? || subject is List<*>)
|
||||
.and(subject is OpinionChoice?)
|
||||
}
|
||||
|
||||
override fun vote(action: ActionI, call: ApplicationCall, subject: Any?): Vote {
|
||||
@@ -18,14 +18,6 @@ class OpinionChoiceVoter : Voter {
|
||||
if (subject is OpinionChoice) {
|
||||
return Vote.GRANTED
|
||||
}
|
||||
if (subject is List<*>) {
|
||||
subject.forEach {
|
||||
if (it !is OpinionChoice) {
|
||||
return Vote.DENIED
|
||||
}
|
||||
}
|
||||
return Vote.GRANTED
|
||||
}
|
||||
return Vote.DENIED
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user