@Test
public void testGetSensorWithTransaction() {

    final String sql = "select s from Sensor s where s.name = ?1";
    final String sensorName = "blabla";
    final Sensor sensor = new SensorBuilder().name(sensorName).build();
    when(persistenceManager.pick(sql, sensorName)).thenReturn(sensor);
    final Sensor toolStorageSensor = jpaStorage.getSensorWithTransaction(sensorName);
    assertNotNull(toolStorageSensor);
    assertEquals(sensorName, toolStorageSensor.getName());
    verify(persistenceManager, times(1)).transaction();
    verify(persistenceManager, times(1)).pick(sql, sensorName);
    verify(persistenceManager, times(1)).commit();
    verifyNoMoreInteractions(persistenceManager);
}