I'm testing a class that (apart from interacting with others) creates an object with fields made up of constants and values passed from caller:
private String createService(Long organizationId, String prototypeId,
MedicalService medicalService)
{
ServiceType service = new ServiceType();
service.setClinic(organizationId.toString());
service.setType("0");
service.setPrototype(prototypeId);
service.setCode(medicalService.getCode());
service.setName(medicalService.getName());
service.setIndependent(true);
service.setRepeated(false);
return remoteWS.createService(service);
}
Should i test that every field is set appropriately? The reason I'm making doubt is that it would introduce duplication and decrease readability. Particularly I'm inclined to do reflection assert. That would only allow to detect some "stupid" typing errors, e.g. writing code to name field if both are of type String.
Is this duplication and reasonable?
Aucun commentaire:
Enregistrer un commentaire