I am using srping framework for API testing. For negative test cases where API returns error codes like 400,401,403. feign always throws an exception
Is there any way I can catch Actual API response instead of feign exception and assert it.
@FeignClient(name = "StockTransferProxy", url = "${app.url}")
public interface `StockTransferProxy` {
@PutMapping(value = "${api.scanItems}")
ScannedItemResponse scanItems(@RequestHeader(HttpHeaders.AUTHORIZATION)String auth,
@RequestParam("transferId") String transferId,
@RequestBody ScannedItemRequest body);
}
Testcase file
@EnableWebTests
public class StockTransfer extends CoreTest {
private static final Logger log = LoggerFactory.getLogger(StockTransfer.class);
private String auth = "...";
@Autowired
private StockTransferProxy stockTransferProxy;
@Test
public void stockTransfer_1() {
ScannedItemResponse scannedItem = stockTransferProxy.scanItems(auth, transferId, new ScannedItemRequest("010001707340051"));}
Any help on getting the actual http status code and message