@Test
void testGetConnectionShouldReturnExistingConnectionWhenInCache() throws Exception {

    // Arrange
    final String deviceIdentification = "DA_DVC_1";
    final Iec60870Device device = Iec60870DeviceFactory.createDistributionAutomationDevice(deviceIdentification);
    when(this.iec60870DeviceRepository.findByDeviceIdentification(deviceIdentification))
            .thenReturn(Optional.of(device));
    final RequestMetadata requestMetadata = RequestMetadataFactory.forDevice(deviceIdentification);
    final ClientConnection expectedConnection = ClientConnectionFactory.forDevice(deviceIdentification);
    this.connectionCache.addConnection(deviceIdentification, expectedConnection);
    // Act
    final ClientConnection actualConnection = this.clientConnectionService.getConnection(requestMetadata);
    // Assert
    assertThat(actualConnection).isEqualTo(expectedConnection);
}