support/cas-server-support-jdbc/src/test/java/org/apereo/cas/adaptors/jdbc/QueryDatabaseAuthenticationHandlerTests.java
/**
     *  This test proves that in case BCRYPT is used authentication using encoded password always fail
     * with FailedLoginException
     * @throws Exception
     */
This test proves that in case BCRYPT is used authentication using encoded password always fail
with FailedLoginException
@throws Exception
This test proves that in case BCRYPT is used authentication using encoded password always fail with FailedLoginException @throws Exception
@Test(expected = FailedLoginException.class)
    public void verifyBCryptFail() throws Exception {
        final QueryDatabaseAuthenticationHandler q = new QueryDatabaseAuthenticationHandler();
        q.setDataSource(this.dataSource);
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(8,
                new SecureRandom("secret".getBytes(StandardCharsets.UTF_8)));
        q.setSql(SQL.replace("password", "'" + encoder.encode("psw0") +"' password"));
        q.setPasswordEncoder(encoder);
        q.authenticateUsernamePasswordInternal(
                TestUtils.getCredentialsWithDifferentUsernameAndPassword("user0", "psw0"));
    }
@ Test ( expected = FailedLoginException . class ) public void verifyBCryptFail ( ) throws Exception { final QueryDatabaseAuthenticationHandler q = new QueryDatabaseAuthenticationHandler ( ) ; q . setDataSource ( this . dataSource ) ; BCryptPasswordEncoder encoder = new BCryptPasswordEncoder ( 8 , new SecureRandom ( "secret" . getBytes ( StandardCharsets . UTF_8 ) ) ) ; q . setSql ( SQL . replace ( "password" , "'" + encoder . encode ( "psw0" ) + "' password" ) ) ; q . setPasswordEncoder ( encoder ) ; q . authenticateUsernamePasswordInternal ( TestUtils . getCredentialsWithDifferentUsernameAndPassword ( "user0" , "psw0" ) ) ; }
This test proves that in case BCRYPT is used authentication using encoded password always fail
 with FailedLoginException
 @throws Exception
This test proves that in case BCRYPT is used authentication using encoded password always fail with FailedLoginException @throws Exception