@Test
public void testStoreSensorWithTransaction() {

    final Sensor sensor = new SensorBuilder().name("a_sensor").observationType(InsituObservation.class).pattern(4000000000L).build();
    doThrow(new PersistenceException(null, null, null, true)).when(persistenceManager).persist(sensor);
    try {
        jpaStorage.storeWithTransaction(sensor);
        fail("ToolException expected");
    } catch (ToolException expected) {
    }
    verify(persistenceManager, times(1)).transaction();
    verify(persistenceManager, times(1)).persist(sensor);
    verify(persistenceManager, times(1)).rollback();
    verifyNoMoreInteractions(persistenceManager);
}