lundi 29 mai 2023

Use of ReflectionTestUtils.setField() in Junit testing to set a List of objects

in my implementation , i have

List<recordEntity> entityList = service.mapper(parameter1,parameter2);

i need to set the value for this entityList with a static value for my unit testing, i know that using ReflectionsTestUtils we can set value, even i have used this for another scenaro,

ReflectionTestUtils.setField(classObject, "implementations", Collections.singletonMap("mapper", new DTOMapper()));

but am not sure how to set a list





Aucun commentaire:

Enregistrer un commentaire