def METHOD_NAME(buffer_connection, at_cmd_test_class):
    from moler.exceptions import CommandFailure
    buffer_connection.remote_inject_response(["AT+CMD\ndata\nERROR\n"])
    at_cmd = at_cmd_test_class("AT+CMD", connection=buffer_connection.moler_connection)
    with pytest.raises(CommandFailure) as error:
        at_cmd()
    assert 'AT+CMD' in str(error.value)
    assert "failed with >>ERROR<<" in str(error.value)