how can I test in memory repository which is reading objects from JSON files in resource folder?
Repository:
@Repository
public class MyRepository{
private TreeMap<String, MyObject> objects;
private ObjectMapper mapper;
@Autowired
public MyRepository(ObjectMapper objectMapper) throws IOException {
// mapping objects from /resources to TreeMap
}
// some custom methods working on my objects
}
Now I want to test these methods, but I dont want to use "real" objects. What is the best way to test it? Should I create some constructor that would take some collection of objects as parameter?
Aucun commentaire:
Enregistrer un commentaire