Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to keep static fixtures (files) in Java project?

I'm testing a number of classes which manipulate files on disc. I created a number of "mocked" files which I will pass to these classes. The question is where in my directory tree I should save them? I'm using Maven.

like image 229
yegor256 Avatar asked Oct 31 '25 00:10

yegor256


1 Answers

It sounds like they should be in src/main/resources, if you need them at runtime, or src/test/resources if they're merely inputs to tests.

This is assuming that they're otherwise opaque data files with no special properties that Maven can do anything interesting with (for example, XSD schemas/SQL/scripting language files).

like image 150
Andrzej Doyle Avatar answered Nov 01 '25 16:11

Andrzej Doyle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!