@Test public void testNumberOfMessageGroupsShouldNotExceedCacheSize() { final Set<String> groupIds = new HashSet<>(); for (int i = 0; i < 10000; i++) { final String uuid = UUID.randomUUID().toString(); groupIds.add(this.messageSender.getMessageGroupId(uuid)); } final int actual = groupIds.size(); assertThat(actual <= this.messageGroupCacheSize) .as("Number of message groups should not exceed cache size " + this.messageGroupCacheSize).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);  }