### Question:
ExchangeBrokerClient extends Client { public void subscribeToQueue(final String queueName) throws EtiqetException { getTransport().subscribeToQueue( queueName, message -> addMessageToGroup(messagesByQueue, queueName, message) ); } ExchangeBrokerClient(String clientConfig);  ExchangeBrokerClient(String primaryClientConfig, String secondaryClientConfig);  ExchangeBrokerClient(String primaryClientConfig, String secondaryClientConfig, ProtocolConfig protocol); @Override boolean isLoggedOn(); @Override ExchangeTransport getTransport(); void sendMessageToExchange(final Cdr cdr, final String exchangeName); void sendMessageToExchange(final Cdr cdr, final String exchangeName, final String routingKey); void subscribeToQueue(final String queueName); Cdr retrieveMessageFromQueue(final String queueName, Duration timeout); List<Cdr> getReceivedMessagesFromQueue(final String queueName); Optional<Cdr> getLastMessageFromQueue(final String queueName);  }### Answer:
@Test public void testSubscribeToQueue() throws Exception { final String queueName = "queue"; doAnswer( call -> { Consumer<Cdr> listener = call.getArgument(1); listener.accept(aCdr("NONE").build()); return null; } ).when(transport).subscribeToQueue(eq(queueName), any(Consumer.class)); client.subscribeToQueue(queueName); List<Cdr> receivedMessages = client.getReceivedMessagesFromQueue(queueName); assertEquals(1, receivedMessages.size()); assertEquals("NONE", receivedMessages.get(0).getType()); }