@Test
public void testGetSensorWithTransaction_failure() {

    final String sql = "select s from Sensor s where s.name = ?1";
    final String sensorName = "blabla";
    doThrow(new PersistenceException(null, null, null, true)).when(persistenceManager).pick(sql, sensorName);
    try {
        jpaStorage.getSensorWithTransaction(sensorName);
        fail("ToolException expected");
    } catch (ToolException expected) {
    }
    verify(persistenceManager, times(1)).transaction();
    verify(persistenceManager, times(1)).pick(sql, sensorName);
    verify(persistenceManager, times(1)).rollback();
    verifyNoMoreInteractions(persistenceManager);
}