}
private ServerMessage mockMessage(final Map<String, Object> headerValues)
{
final AMQMessageHeader header = mock(AMQMessageHeader.class);
when(header.containsHeader(anyString())).then(new Answer<Boolean>()
{
@Override
public Boolean answer(InvocationOnMock invocation) throws Throwable
{
return headerValues.containsKey((String) invocation.getArguments()[0]);
}
});
when(header.getHeader(anyString())).then(new Answer<Object>()
{
@Override
public Object answer(InvocationOnMock invocation) throws Throwable
{
return headerValues.get((String) invocation.getArguments()[0]);
}
});
when(header.getHeaderNames()).thenReturn(headerValues.keySet());
when(header.containsHeaders(anySet())).then(new Answer<Boolean>()
{
@Override
public Boolean answer(InvocationOnMock invocation) throws Throwable
{
final Set names = (Set) invocation.getArguments()[0];