I\'m trying to find a way to test my entity using Mockito;
This is the simple test method:
@Mock
private EntityManager em;
@Test
public void persistArti
You could use a Mockito Answer
for this.
doAnswer(new Answer
This tells Mockito that when the persist
method is called, the first argument should have its setId
method invoked.
But if you do this, I don't understand what the purpose of the test would be. You'd really just be testing that the Mockito Answer
mechanism works, not that the code of Article
or of EntityManager
works correctly.