Is it a code smell if the consumers of a class do not need a particular public method of the said class, but having the method simplifies its testing significantly?

Consider the following example:

class HugeBlackBox {
    construct() {}

    public getPartOfTheState() {} // <-- the method is intended for testing only

    // mostly private methods
}

In case the above class smells, what are the suggested refactoring techniques when encountering such situations?

marked as duplicate by Kilian Foth, gnat, Robert Harvey, amon, nvoigt Nov 27 at 16:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.