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
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
나는 올바른 구문을 알아 냈습니다.
Service mockedService = new DefaultServie();
doNothing().when(mockedService).sendReportingLogs(null);
이것이 질문에 답하기를 바랍니다.