@SuppressWarnings("checkstyle:MethodName")
    @Test
    void getRememberedPrincipalsDecryptionError_whenInvalidBase64() {
        HttpServletRequest mockRequest = createNiceMock(HttpServletRequest.class);
        HttpServletResponse mockResponse = createNiceMock(HttpServletResponse.class);

        WebSubjectContext context = new DefaultWebSubjectContext();
        context.setServletRequest(mockRequest);
        context.setServletResponse(mockResponse);

        expect(mockRequest.getAttribute(ShiroHttpServletRequest.IDENTITY_REMOVED_KEY)).andReturn(null);

        // Simulate a bad return value here (not valid Base64)
        String userPCAesBase64 = "InvalidBase64";
        Cookie[] cookies = new Cookie[] {
                new Cookie(CookieRememberMeManager.DEFAULT_REMEMBER_ME_COOKIE_NAME, userPCAesBase64)
        };

        expect(mockRequest.getCookies()).andReturn(cookies).anyTimes();
        replay(mockRequest);

        CookieRememberMeManager mgr = new CookieRememberMeManager();
        PrincipalCollection rememberedPrincipals = mgr.getRememberedPrincipals(context);
        assertNull(rememberedPrincipals, "rememberedPrincipals should be null on invalid cookies.");
    }
Unit tests for the {@link CookieRememberMeManager} implementation.

@since 1.0
web/src/test/java/org/apache/shiro/web/mgt/CookieRememberMeManagerTest.java