Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simplify unit tests with JUnit 5 and Apache Shiro

License

NotificationsYou must be signed in to change notification settings

sdorra/junit-shiro-extension

Repository files navigation

JUnit Shiro Extension

JUnit Shiro Extension

Simplify unit tests with JUnit 5 and Apache Shiro.

Usage

@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.

Installation

Get the latest stable version fromMaven Central

Gradle

testImplementation'com.github.sdorra:junit-shiro-extension:x.y.z'

Maven

<dependency>  <groupId>com.github.sdorra</groupId>  <artifactId>junit-shiro-extension</artifactId>  <version>x.y.z</version>  <scope>test</scope></dependency>

License

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

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp