Stubber 类型中的方法 when(T) 不适用于参数 (void)
我在存根 void 时收到以下错误:
Stubber 类型中的方法 when(T) 不适用于参数 (void)
这是我的示例代码:
doNothing().when(mockRegistrationPeristImpl.create(any(Registration.class)));
public void create(final T record) throws DataAccessException {
try {
entityManager.persist(record);
entityManager.flush();
} catch (PersistenceException ex) {}
}
我错过了什么?