I want to run some unit tests without the need of the Spring context because of speed reasons. But I also like the way I can inject files into my tests
Here is an example testcode I use:
@ContextConfiguration()
@SpringBootTest
@RunWith(SpringRunner.class)
public class XmlRestructureApplierTest {
@Value("classpath:export.xml")
private Resource exportedXML;
private XmlRestructureApplier applier;
@Test
public void shouldRestructureArrayToObjectWithGivenKey() throws IOException, XPathExpressionException, SAXException {
List<JSONObject> productsAsJSONObjects = XmlElementExtractor.extractToJSON(exportXML.getInputStream(), "PRV");
assertThat(productsAsJSONObjects).hasSize(6);
}
}
I'd like to have only the convenient way of using @Value without launching the whole time consuming context.
Is this somehow possible?