This is part of the problem with too fine tests and is closely related to the implementation.
Personally, I would write tests that focus on the behavior of the algorithm and will consider this โunitโ. The fact that it is divided into several classes is a detail of the implementation, just as the destruction of the function of a public method in several smaller private methods is also a detail of the implementation. I would not write tests for private methods separately, they would be tested using tests of the functionality of the public method.
If some of these classes are generally useful and will be reused elsewhere, I would think of writing unit tests for them at this point, since they themselves will have a certain behavior.
This will lead to some duplication, but this is normal, because these classes now have an open support contract (and which is used by both components that use it), which can be determined by these tests.
Interestingly, see the definition of Unit in this article.
source share