@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_message == null) ? 0 : new Long(_message.getMessageNumber()).hashCode()); result = prime * result + ((_queue == null) ? 0 : _queue.getId().hashCode()); return result; }
private Record getTestRecord(long messageNumber) { UUID queueId1 = UUIDGenerator.generateRandomUUID(); TransactionLogResource queue1 = mock(TransactionLogResource.class); when(queue1.getId()).thenReturn(queueId1); EnqueableMessage message1 = mock(EnqueableMessage.class); when(message1.isPersistent()).thenReturn(true); when(message1.getMessageNumber()).thenReturn(messageNumber); when(message1.getStoredMessage()).thenReturn(new MockStoredMessage(messageNumber)); Record enqueueRecord = new TestRecord(queue1, message1); return enqueueRecord; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Record)) { return false; } Record other = (Record) obj; if (_message == null && other.getMessage() != null) { return false; } if (_queue == null && other.getQueue() != null) { return false; } if (_message.getMessageNumber() != other.getMessage().getMessageNumber()) { return false; } return _queue.getId().equals(other.getQueue().getId()); }