@Test
public void testRetrieveThings() {

    new TestKit(actorSystem) {{
        final Props props = ConnectivityProxyActor.props(getRef());
        final ActorRef proxy = actorSystem.actorOf(props);
        final List<Thing> thingList = IntStream.range(0, 10)
                .mapToObj(i -> ThingId.of(KNOWN_THING_ID.getNamespace(), KNOWN_THING_ID.getName() + "-" + i))
                .map(id -> Thing.newBuilder().setId(id).build())
                .collect(Collectors.toList());
        final ThingId[] thingIdsArray =
                thingList.stream().map(Thing::getEntityId).map(Optional::get).toArray(ThingId[]::new);
        final String correlationId = UUID.randomUUID().toString();
        final DittoHeaders headers =
                DittoHeaders.newBuilder().correlationId(correlationId).contentType("application/json").build();
        final RetrieveThings retrieveThings =
                RetrieveThings.getBuilder(thingIdsArray).dittoHeaders(headers).build();
        // WHEN: RetrieveThings is sent to proxy actor
        proxy.tell(retrieveThings, getRef());
        // THEN: command is forwarded to concierge
        expectMsg(retrieveThings);
        // WHEN: concierge responds with SourceRef of things
        final SourceRef<RetrieveThingResponse> retrieveThingResponseSourceRef =
                Source.from(retrieveThings.getThingEntityIds())
                        .map(thingId -> Thing.newBuilder().setId(thingId).build())
                        .map(thing -> RetrieveThingResponse.
                                of(thing.getEntityId().orElseThrow(), thing, DittoHeaders.empty()))
                        .runWith(StreamRefs.sourceRef(), actorSystem);
        getLastSender().tell(retrieveThingResponseSourceRef, ActorRef.noSender());
        // THEN: original sender receives
        final RetrieveThingsResponse retrieveThingsResponse = expectMsgClass(RetrieveThingsResponse.class);
        assertThat(retrieveThingsResponse.getThings()).containsExactlyElementsOf(thingList);
    }};
}