2015-09-03 13 views
7

argümanlar (boşluk) için geçerli değildir yöntemi:tip Stubber (T) bir boşluğu stubbing zaman alıyorum hatayı takip ediyorum

türü yöntemi (T) Stubber değil argümanlar (boşluk) İşte

için geçerli benim örnek kod edilir:

doNothing().when(mockRegistrationPeristImpl.create(any(Registration.class))); 

public void create(final T record) throws DataAccessException { 
    try { 
     entityManager.persist(record); 
     entityManager.flush(); 
    } catch (PersistenceException ex) {} 
} 

ben eksik?

+0

Olası kopyalar (https://stackoverflow.com/questions/15156857/mockito-test [Mockito bir boşluk yöntem bir istisna atar sınamak] -a-void-method-throws-bir istisna) –

cevap

19

Sizin parantez yanlış yerde olduğunu, bu deneyin:

doNothing().when(mockRegistrationPeristImpl).create(any(Registration.class)); 
ait
+0

Şimdi çalışır. Teşekkürler – user3123934

İlgili konular