Keycloak secret question example

I’m trying to run the example for adding a secret question to learn about how to add an action to keycloak. It builds, but gets a runtime error :

Uncaught server error: java.lang.NoSuchMethodError: org.keycloak.credential.UserCredentialStore.getStoredCredentialsByTypeStream(Lorg/keycloak/models/RealmModel;Lorg/keycloak/models/UserModel;Ljava/lang/String;)Ljava/util/stream/Stream;

I did see the example is deprecated. Is there an easy way to fix this example? If I comment out the calls to the CredentialProvider, then it runs.

Here’s the method the error happens in (the forum wont let me post the entire file)
public boolean isConfiguredFor(RealmModel realm, UserModel user, String credentialType) {
if (!supportsCredentialType(credentialType)) return false;
return getCredentialStore().getStoredCredentialsByTypeStream(realm, user, credentialType).count() > 0;

Some supporting code:
protected KeycloakSession session;

public SecretQuestionCredentialProvider(KeycloakSession session) {
    this.session = session;

private UserCredentialStore getCredentialStore() {
    return session.userCredentialManager();

I found the reason. The example was built against version 12.0.4, but I was running with 11.0.3, so that method was not available at run time.