@Test
void subscribeExistingDevice() {

    // SETUP
    when(this.messageMetadata.getDeviceIdentification()).thenReturn("test-metadata-device-id");
    final MqttDevice device = mock(MqttDevice.class);
    when(this.mqttDeviceRepository.findByDeviceIdentification(
            this.messageMetadata.getDeviceIdentification())).thenReturn(device);
    when(this.mqttClientAdapterFactory.create(eq(device), eq(this.messageMetadata), eq(this.instance))).thenReturn(
            this.mqttClientAdapter);
    // CALL
    this.instance.subscribe(this.messageMetadata);
    // VERIFY
    verify(this.mqttClientAdapter).connect();
}