public String toBaseMessageIdString(Object messageId) {
        if (messageId == null) {
            return null;
        } else if (messageId instanceof String) {
            String stringId = (String) messageId;

            // If the given string has a type encoding prefix,
            // we need to escape it as an encoded string (even if
            // the existing encoding prefix was also for string)
            if (hasTypeEncodingPrefix(stringId)) {
                return AMQP_STRING_PREFIX + stringId;
            } else {
                return stringId;
            }
        } else if (messageId instanceof UUID) {
            return AMQP_UUID_PREFIX + messageId.toString();
        } else if (messageId instanceof UnsignedLong) {
            return AMQP_ULONG_PREFIX + messageId.toString();
        } else if (messageId instanceof Binary) {
            ByteBuffer dup = ((Binary) messageId).asByteBuffer();

            byte[] bytes = new byte[dup.remaining()];
            dup.get(bytes);

            String hex = convertBinaryToHexString(bytes);

            return AMQP_BINARY_PREFIX + hex;
        } else {
            throw new IllegalArgumentException("Unsupported type provided: " + messageId.getClass());
        }
    }
@Test
    public void testToBaseMessageIdStringWithUnsignedLong() {
        UnsignedLong uLongMessageId = UnsignedLong.valueOf(123456789L);
        String expected = AMQPMessageIdHelper.AMQP_ULONG_PREFIX + uLongMessageId.toString();

        String baseMessageIdString = messageIdHelper.toBaseMessageIdString(uLongMessageId);
        assertNotNull("null string should not have been returned", baseMessageIdString);
        assertEquals("expected base id string was not returned", expected, baseMessageIdString);
    }