Right now the macro JUCE_UNIT_TESTS omits the declaration of the unit test classes as well as the definition of the static variable. Maybe it should only omit the definition, this way the declarations will still be compiled and checked for syntax in case a change breaks them.
If anyone uses those unit tests as an example, and also omits the declarations as the JUCE code does then they might only rarely have unit tests compiled, depending on how often the code is checked.