List of usage examples for javax.persistence PersistenceException PersistenceException
public PersistenceException()
PersistenceException
exception with null
as its detail message. From source file:cz.muni.fi.airportservicelayer.services.DestinationServiceTest.java
@Test(expectedExceptions = BasicDataAccessException.class) public void testThrowBasicDataAccesException() { when(destinationDao.findAll()).thenThrow(new PersistenceException()); destinationService.findAllDestinations(); }
From source file:cz.muni.fi.airportservicelayer.services.AirplaneServiceTest.java
@Test(expectedExceptions = BasicDataAccessException.class) public void testThrowBasicDataAccesException() { when(airplaneDao.findAllAirplanes()).thenThrow(new PersistenceException()); airplaneService.findAllAirplanes();// w w w . j a v a2 s . c om }
From source file:cz.muni.fi.airportservicelayer.services.StewardServiceTest.java
@Test(expectedExceptions = BasicDataAccessException.class) public void testThrowBasicDataAccesException() { when(stewardDao.update(s1)).thenThrow(new PersistenceException()); stewardService.updateSteward(s1, null); }
From source file:org.wte4j.impl.WordTemplateRepositoryTest.java
@Test @Transactional/* w w w. j a v a2 s . co m*/ public void errorsWithFileStore() throws Exception { WordTemplate<?> template = unlockedTemplate(); FileStore fileStore = mock(FileStore.class); repository.setFileStore(fileStore); EntityManager entityManager = mock(EntityManager.class); when(entityManager.merge(any())).thenThrow(new PersistenceException()); repository.em = entityManager; try { repository.persist(template); fail("Exception expected"); } catch (Exception e) { verifyZeroInteractions(fileStore); } }
From source file:org.wte4j.persistence.WordTemplateRepositoryTest.java
@Test @Transactional//from www. j a v a2s .com public void errorsWithFileStore() throws Exception { WordTemplate<?> template = unlockedTemplate(); FileStore fileStore = mock(FileStore.class); repository.setFileStore(fileStore); EntityManager entityManager = mock(EntityManager.class); when(entityManager.merge(any())).thenThrow(new PersistenceException()); repository.em = entityManager; try { repository.persist(template); fail("Exception expected"); } catch (Exception e) { verifyZeroInteractions(fileStore); } }