Connection connection = mock(Connection.class);
Channel channel = mock(Channel.class);
when(connectionFactory.createConnection()).thenReturn(connection);
when(connection.createChannel(Mockito.anyBoolean())).thenReturn(channel);
when(channel.queueDeclarePassive(Mockito.anyString()))
.then(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Object arg = invocation.getArguments()[0];