Search in sources :

Example 1 with EntityManagerTemplate

use of com.quorum.tessera.data.EntityManagerTemplate in project tessera by ConsenSys.

the class PrivacyGroupDAOTest method retrieveOrSaveThrows.

@Test(expected = IllegalStateException.class)
public void retrieveOrSaveThrows() {
    EntityManagerTemplate template = new EntityManagerTemplate(ENTITY_MANAGER.get().getEntityManagerFactory());
    Supplier<PrivacyGroupEntity> mockRetriever = mock(Supplier.class);
    when(mockRetriever.get()).thenReturn(null);
    Supplier<PrivacyGroupEntity> mockFactory = mock(Supplier.class);
    when(mockFactory.get()).thenThrow(new IllegalStateException("OUCH"));
    template.retrieveOrSave(mockRetriever, mockFactory);
}
Also used : PrivacyGroupEntity(com.quorum.tessera.data.PrivacyGroupEntity) EntityManagerTemplate(com.quorum.tessera.data.EntityManagerTemplate)

Aggregations

EntityManagerTemplate (com.quorum.tessera.data.EntityManagerTemplate)1 PrivacyGroupEntity (com.quorum.tessera.data.PrivacyGroupEntity)1