@Test
public void testStoreDataFileWithTransaction() {

    final String sql = "select f from DataFile f where f.path = ?1";
    final String path = "/left/of/rome";
    final DataFile dataFile = createDataFile(path);
    when(persistenceManager.pick(sql, path)).thenReturn(dataFile);
    final int storedId = jpaStorage.storeWithTransaction(dataFile);
    assertEquals(ID, storedId);
    verify(persistenceManager, times(1)).persist(dataFile);
    verify(persistenceManager, times(1)).pick(sql, path);
    verify(persistenceManager, times(1)).pick("select s from Sensor s where s.name = ?1", "cloud");
    verify(persistenceManager, times(2)).transaction();
    verify(persistenceManager, times(2)).commit();
    verifyNoMoreInteractions(persistenceManager);
}