    @Test
    public void shouldRejectMessageOnException() throws IOException {

        FunctionConsumer<TestMsg> consumer =
            new FunctionConsumer<>(channel, msg -> {
                throw new RuntimeException("Message processing failed on purpose.");
            }, TestMsg.class, "name", metrics);

        consumer.handleDelivery(null, envelope, null, message);

        verify(channel).basicNack(1L, false, true);
    }