【发布时间】:2020-07-13 14:03:30
【问题描述】:
我想在运行 void 方法时抛出异常
when(booking.validate(any())).thenThrow(BookingException.builder().build());
但我有一个编译错误:
Required type: T
Provided: void
reason: no instance(s) of type variable(s) T exist so that void conforms to T
【问题讨论】:
标签: java spring spring-boot junit mockito