I have a class (ConfigurationReaderUtil) that loads an XML config file to beans (with the simpleframework). There is an other class (let's name it as XXX class) that uses the beans that are loaded by the ConfigurationReaderUtil.
I want to test the class XXX. It is important to test the wrong cases when there are invalid data in the XML config file. So at the moment I have a XML file in the src/test/resource that can be used to test the successful cases. I'd also need more XML file in the src/test/resource for testing the wrong cases.
However I have something like this in the ConfigurationReaderUtil:
InputStream in = new ClassPathResource(Constants.PATH_TEMPLATE_CONFIG_XML).getInputStream();
templatesBean = serializer.read(TemplatesBean.class, in);
So what I'd need is to load different XML files for different unit tests. I really don't know how I could achieve this. Can I define somehow in the unit test which test XML file I need? However in this case how should I write the ConfigurationReaderUtil class?
Hmm, this is the dilemma...
Thanks,
V.