@Override
    public MessageQueue select(List<MessageQueue> mqs, Message msg, Object arg) {
        int value = arg.hashCode() % mqs.size();
        if (value < 0) {
            value = Math.abs(value);
        }
        return mqs.get(value);
    }
@Test
    public void testSelect() throws Exception {
        SelectMessageQueueByHash selector = new SelectMessageQueueByHash();

        Message message = new Message(topic, new byte[] {});

        List<MessageQueue> messageQueues = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            MessageQueue messageQueue = new MessageQueue(topic, "DefaultBroker", i);
            messageQueues.add(messageQueue);
        }

        String orderId = "123";
        String anotherOrderId = "234";
        MessageQueue selected = selector.select(messageQueues, message, orderId);
        assertThat(selector.select(messageQueues, message, anotherOrderId)).isNotEqualTo(selected);

        //No exception is thrown while order Id hashcode is Integer.MIN
        anotherOrderId = "polygenelubricants";
        selector.select(messageQueues, message, anotherOrderId);
        anotherOrderId = "GydZG_";
        selector.select(messageQueues, message, anotherOrderId);
        anotherOrderId = "DESIGNING WORKHOUSES";
        selector.select(messageQueues, message, anotherOrderId);
    }