Skip to content

Instantly share code, notes, and snippets.

@antony
Created November 30, 2015 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antony/85d72cce69629ec7386d to your computer and use it in GitHub Desktop.
Save antony/85d72cce69629ec7386d to your computer and use it in GitHub Desktop.
Unit Testing Shiro Subjects with Spock
class ShiroAwareSpecification extends Specification {
@Shared Subject subject
@Shared ThreadState threadState
void setupSpec() {
subject = Mock(Subject)
threadState = new SubjectThreadState(subject)
threadState.bind()
}
void cleanupSpec() {
if (threadState) {
threadState.clear()
threadState = null
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment