草庐IT

ContentIOException

全部标签

java - 从 Mockito 抛出异常

我想从签名看起来像这样的方法中抛出ContentIOException。publicvoidputContent(InputStreamis)throwsContentIOException.当我尝试像这样从Mockito抛出ContentIOException时:when(StubbedObject.putContent(contentStream)).thenThrow(ContentIOException.class);我收到以下编译错误:Themethodwhen(T)inthetypeMockitoisnotapplicableforthearguments(void).我做

java - 从 Mockito 抛出异常

我想从签名看起来像这样的方法中抛出ContentIOException。publicvoidputContent(InputStreamis)throwsContentIOException.当我尝试像这样从Mockito抛出ContentIOException时:when(StubbedObject.putContent(contentStream)).thenThrow(ContentIOException.class);我收到以下编译错误:Themethodwhen(T)inthetypeMockitoisnotapplicableforthearguments(void).我做