Wizards and Warriors Exercise

I am passing all tests except for the one testing for 12 points when a wizard has a spell prepared. However, this is the implementation I have for that class, and I cannot tell why it is failing:

class Wizard extends Fighter {

    public boolean hasPreparedSpell = false;
    
    @Override
    boolean isVulnerable() {
        return !hasPreparedSpell;
    }

    @Override
    int getDamagePoints(Fighter fighter) {
        if (!fighter.isVulnerable()) {
            return 12;
        }
        return 3;
    }

    void prepareSpell() {
        hasPreparedSpell = true;
    }

    public String toString() {
        return "Fighter is a Wizard";
    }
}

The damage dealt by a Warrior depends on whether or not the opponent is vulnerable.

The damage dealt by a wizard depends on whether or not the wizard prepared a spell; It does not depend on whether or not the opponent is vulnerable.

Right, but the isVulnerable check is the opposite of whether a spell is prepared. If I’ve prepared a spell, I am not vulnerable anymore.

You’re checking the fighter when you’re supposed to check the wizard.