@Test
public void testGetDataFileWithTransaction_fails() {

    final String sql = "select f from DataFile f where f.path = ?1";
    final String path = "/over/the/rainbow";
    doThrow(new PersistenceException(null, null, null, true)).when(persistenceManager).pick(sql, path);
    try {
        jpaStorage.getDatafileWithTransaction(path);
        fail("ToolException expected");
    } catch (ToolException expected) {
    }
    verify(persistenceManager, times(1)).transaction();
    verify(persistenceManager, times(1)).pick(sql, path);
    verifyNoMoreInteractions(persistenceManager);
}