How can I test my controller for throwing an exception in Kotlin?
So i have a controller with one GET method. I need to test it. When i write in url request with incorrect iso code of the country, it throws me back a custom exception. So how can i test it?
So here 'UA' is incorrect argument
@Test
fun check_for_incorrect_iso_code() {
mockMvc.perform(get("/countries/UA"))
.andDo(print())
.andExpect(status().is4xxClientError)
}
Test is working, but i need to extend it and check if it throws my custom exception - 'InvalidIsoCodeException'...