0

I am working on bigger project and I would like to ask how should I organize files used for unit tests in resources folder. I used to put it directly in resources folder, but how the project grows, it is getting messy. Is there some convention for this? Should I for example for class com.znamenacek.somepackage.MyClass.java put it in resources/com/znamenacek/somepackage/Myclass ?

Jakub Znamenáček
  • 766
  • 1
  • 4
  • 18
  • I hope you put them into `src/test/resources` directory. If those resources related to particular classes I would add the package (directory) into the resources directory as well.. if there are too much you might need to separate your module into two modules... – khmarbaise Jul 29 '22 at 09:44
  • Hi khmarbaise, thank you for you answer. Yes, I am putting them under `src/test/resources`. I just wasn't sure how to organise them there. From you reply I understand that if the file is necessary for the test testing concrete class, it should be in the directory structure similar to package. So for `com.znamenacek.somepackage.MyClass.java` it should be in `src/test/resources/com/znamenacek/somepackage/Myclass` right? – Jakub Znamenáček Jul 29 '22 at 11:14
  • Yes I would go that direction. The other question is why do you need so many resources? Usually unit tests tend not that often to really need resources..(only my POV).. – khmarbaise Jul 29 '22 at 12:57

0 Answers0