This is a question about best practices for unit tests. Let's say I have a ClassA
that does some object transforms (from CSVs to Java beans, using external library). Then I have ClassB
that needs these transformed Java beans to execute a calculation. When writing a unit test for ClassB
, is it acceptable to use ClassA
's transform method to get these transformed bean objects? In other words, use an application class as utility in unit test.
The other option would be to write a util test method which would have same code as ClassA
(the transformation is done using an external library, so it's easy to use it in both application class and test utility class)
Aucun commentaire:
Enregistrer un commentaire