I have this class with this void method that maps a JSON string to a DTO:
public class OBTMapper {
public void Mapper(String line){
final ObjectMapper objectMapper = new ObjectMapper();
final DTO dto;
try {
dto = objectMapper.readValue(line, DTO.class);
System.out.println(dto);
} catch (JsonProcessingException e) {
System.out.println("haha");
throw new IllegalArgumentException("Error parsing the JSON String");
}
}
}
How can I unit test this method to make sure that the method does what it should?