java - Missing method call for verify(mock) here -


i have problem mockito. code program

public boolean bajacontribuyente(string dni){         contribuyente c = em.find(contribuyente.class, dni);         if(c!=null){                 em.remove(c);                 return true;         }         return false;     } 

and test:

@beforeclass public static void setupbeforeclass()throws exception{      contribuyentedao.setem(em);;     when(contribuyented.getdni()).thenreturn("4");     when(em.find(contribuyente.class, "4")).thenreturn(contribuyented); }  @test public void testbajacontribuyente(){             contribuyentedao.bajacontribuyente("4");     verify(em).find(contribuyente.class, "4");     verify(em).remove(contribuyented); }    

junit missing method call verify(mock), dont know why

you need add static import of mockito's methods (e.g. verify), following:

import static org.mockito.mockito.*; 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -