- Notifications
You must be signed in to change notification settings - Fork0
Simplify unit tests with JUnit 5 and Apache Shiro
License
NotificationsYou must be signed in to change notification settings
sdorra/junit-shiro-extension
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Simplify unit tests with JUnit 5 and Apache Shiro.
@ExtendWith(ShiroExtension.class)@SubjectAware(value ="trillian",roles ="user",permissions ="one:*")classShiroExtensionTest {@TestvoidshouldHavePreparedSubject() {Subjectsubject =SecurityUtils.getSubject();assertThat(subject.getPrincipal()).isEqualTo("trillian");assertThat(subject.hasRole("user")).isTrue();assertThat(subject.isPermitted("one:dot:one")).isTrue(); }}
TheSubjectAware annotation can be placed on classes, nested classes or on methods.Roles and permissions are merged. If thevalue is ofSubjectAware is empty, no subject is bound.
For more samples have a look at theShiroExtensionTest.
Get the latest stable version from
testImplementation'com.github.sdorra:junit-shiro-extension:x.y.z'<dependency> <groupId>com.github.sdorra</groupId> <artifactId>junit-shiro-extension</artifactId> <version>x.y.z</version> <scope>test</scope></dependency>
This project is licensed under the MIT License - see theLICENSE file for details
About
Simplify unit tests with JUnit 5 and Apache Shiro
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
