You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by "bmarwell (via GitHub)" <gi...@apache.org> on 2023/03/30 17:48:22 UTC

[GitHub] [shiro] bmarwell commented on a diff in pull request #815: Reworked CDI principal injection API using Supplier

bmarwell commented on code in PR #815:
URL: https://github.com/apache/shiro/pull/815#discussion_r1153592928


##########
integration-tests/jakarta-ee/src/test/java/org/apache/shiro/testing/cdi/ComponentInjectionIT.java:
##########
@@ -103,8 +104,8 @@ void sessionInjection() {
     @OperateOnDeployment(TESTABLE_MODE)
     void principalInjection() {
         SecurityUtils.getSubject().login(new UsernamePasswordToken("user", "password"));
-        assertNotNull(injectedComponents.getPropertyPincipal());
-        assertEquals("user", injectedComponents.getPropertyPincipal().orElseThrow().getUserName());
+        assertNotNull(injectedComponents.getPropertyPrincipal());
+        assertEquals("user", Optional.ofNullable(injectedComponents.getPropertyPrincipal().get()).orElseThrow().getUserName());

Review Comment:
   Don't use `get()`, use `orElseThrow()` (on 8 with `NoSuchElementException::new`)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org