In almost all cases I start a new project with actual resources in the files system to prototype and make sure a new system is working but this becomes untenable fairly quickly for the reasons you mention vis-a-vis refactoring.
Ultimately what I end up with is a small generative utility for the type of resource I need. In the recent past that’s been class files, JAR files, Git repos, and JSON documents. Whatever resource I happen to need I create a tool, test the tool, and have it emit resources into the target directory that are used for tests and they get wiped out and regenerated with every clean build. In making changes to the generative tools I usually leave all tests intact and only make additive changes to the generative tool as not to break the output that’s expected. This is the best method that I’ve found. It takes some time to build the generative tool but I find it’s worth it. Trying to manage actual resources as your code and tests get more sophisticated get cumbersome very quickly. > On Oct 3, 2015, at 7:20 PM, Kevin Burton <[email protected]> wrote: > > I'm trying to figure out if there's a better way to do this. > > Java doesn't support "here files" or embedded files.... so you have to keep > your resources external. Usually in 'resources', > > I don't want to have things like HTML code and other things in my tests as > it makes the tests ugly. > > But the problem is that once I create the resources, they can't participate > in refactoring. > > At least in intellij... even if it's *OBVIOUS* that the resource is > associated with a given test. > > Is there a cleaner way to do this? > > Either this whole thing is broken or I'm doing it wrong. > > -- > > We’re hiring if you know of any awesome Java Devops or Linux Operations > Engineers! > > Founder/CEO Spinn3r.com > Location: *San Francisco, CA* > blog: http://burtonator.wordpress.com > … or check out my Google+ profile > <https://plus.google.com/102718274791889610666/posts> Thanks, Jason ---------------------------------------------------------- Jason van Zyl Founder, Takari and Apache Maven http://twitter.com/jvanzyl http://twitter.com/takari_io --------------------------------------------------------- the course of true love never did run smooth ... -- Shakespeare --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
