ElasticConnectionPoolConfigurationPublisher implements ConnectionPoolConfigurationPublisher { int findVersionStartIndex(String nameWithVersion) { if (nameWithVersion != null) { char[] chars = nameWithVersion.toCharArray(); for (int i = 0; i < chars.length; i++) { if (chars[i] == '-') { if (i < chars.length && Character.isDigit(chars[i + 1])) { return i + 1; } } } } return -1; } ElasticConnectionPoolConfigurationPublisher(String applicationName, String clusterName, String vip,
                                                       ConnectionPoolConfiguration config); @Override void publish();  }
@Test public void testFindVersionFindIndex() { ElasticConnectionPoolConfigurationPublisher publisher = new ElasticConnectionPoolConfigurationPublisher("ClientApp", "dyno_cluster_1", "unit-test-vip", config); assertTrue(publisher.findVersionStartIndex(null) < 0); assertTrue(publisher.findVersionStartIndex("foo") < 0); assertTrue(publisher.findVersionStartIndex("foo-bar.jar") < 0); assertTrue(publisher.findVersionStartIndex("foo-bar-2.3") == 8); assertTrue(publisher.findVersionStartIndex("foo-bar-2.3.1-SNAPSHOT") == 8); assertTrue(publisher.findVersionStartIndex("foo-bar-baz-2.3") == 12); }