Created
November 30, 2015 10:28
-
-
Save antony/85d72cce69629ec7386d to your computer and use it in GitHub Desktop.
Unit Testing Shiro Subjects with Spock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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