Unit testing with mock parameter

I’ve made myself a little pretend AudioParameterFloat to run some tests on another class:

class TestParam : public AudioParameterFloat
{
public:
    TestParam(
        const ParameterID& parameterID,
        const String& parameterName,
        int parameterIndex,
        NormalisableRange<float> normalisableRange,
        float defaultValue,
        const AudioParameterFloatAttributes& attributes = {}
    ) :
        AudioParameterFloat(
            parameterID,
            parameterName,
            normalisableRange,
            defaultValue,
            attributes
        ),
        newParamIndex(parameterIndex)
    {
    }
    virtual int getParameterIndex() const noexcept override { return newParamIndex; }
    int newParamIndex;
};

The class I want to test will call getParameterIndex() and I’d like it to receive the index I set in the constructor (newParamIndex). Currently, that’s only working by making AudioProcessorParameter::getParameterIndex() virtual - does anyone have a better way of doing this sort of thing?

I made a new build config which didn’t include the AudioProcessor stuff, fleshed out my pretend parameter class and added a little

#if UNIT_TEST
#include "Mocks.h"
#endif

at the top.

Seems to work…