0

I am using two exception mapper, responseexceptionmapper and exceptionmapper. Now I need to have code coverage from these mappers.

Any examples ?

Sandra
  • 419
  • 7
  • 17

1 Answers1

0

Thouse are just normal classes,

I can provide an example, but for unit testing you just need to instantiate the mapper as a normal class and invoke the ´toResponse´ method providing an exception to obtain a response a check if satisfy your requirements.

For an integration test, you just will invoke with RestAssured your service and verify if the response contains the status and body that was provided by the ExceptionMapper

what kind of logic are developing inside the mappers ?

Javier Toja
  • 1,630
  • 1
  • 14
  • 31
  • In ExceptionMapper, toResponse method is overriden and new response is created with few private method calls. In responseExceptionMapper public RuntimeException toThrowable(Response response) is overriden with few private method calls. – Sandra Sep 22 '21 at 10:47
  • Its a normal QuarkusTest for code coverage – Sandra Sep 23 '21 at 08:46