When testing, sometimes a helper method can be useful for repeated task e.g. in test setup.
We have certain tests against our rest interface using Spring's
RestTemplate. To make it easier, the requests are sent with the help of a helper method (let's call it method
A() for now), which returns the objects from the response.
This helper method
A() seems to pollute the test class, as it is a method which is actually not a test itself. Having multiple helper methods in a test class has a negative effect regarding the overview.
Is it acceptable to create a second class next to the test class, which is containing all helper method? What would be the difficulties if doing so? Or are there any other ways to keep a good overview of the test class?
MyTestClass-> containing only methods which are a actuall test
MyTestClassUtil-> containing all helper methods that are used by