@Test public void testMmessageGroupIdShouldBeSameForSameDevice() { final String deviceId = "test-device-001"; final Set<String> groupIds = new HashSet<>(); for (int i = 0; i < 100; i++) { groupIds.add(this.messageSender.getMessageGroupId(deviceId)); } final int actual = groupIds.size(); assertThat(actual == 1).as("Message group id should be the same for same device").isTrue(); }
protected String getMessageGroupId(final String deviceIdentification) { return String.valueOf(Math.abs(deviceIdentification.hashCode() % this.messageGroupCacheSize)); }
ProtocolRequestMessageSender implements ProtocolRequestService { protected String getMessageGroupId(final String deviceIdentification) { return String.valueOf(Math.abs(deviceIdentification.hashCode() % this.messageGroupCacheSize)); } }
ProtocolRequestMessageSender implements ProtocolRequestService { protected String getMessageGroupId(final String deviceIdentification) { return String.valueOf(Math.abs(deviceIdentification.hashCode() % this.messageGroupCacheSize)); }  }
ProtocolRequestMessageSender implements ProtocolRequestService { protected String getMessageGroupId(final String deviceIdentification) { return String.valueOf(Math.abs(deviceIdentification.hashCode() % this.messageGroupCacheSize)); }  @Override boolean isSupported(final ProtocolInfo protocolInfo); @Override void send(final ProtocolRequestMessage message, final ProtocolInfo protocolInfo); }
ProtocolRequestMessageSender implements ProtocolRequestService { protected String getMessageGroupId(final String deviceIdentification) { return String.valueOf(Math.abs(deviceIdentification.hashCode() % this.messageGroupCacheSize)); }  @Override boolean isSupported(final ProtocolInfo protocolInfo); @Override void send(final ProtocolRequestMessage message, final ProtocolInfo protocolInfo);  }