### Question:
ContactPointUtils { public static void process(final Cluster.Builder clusterBuilder, final String contactPoints) { final String[] splitContactPoints = contactPoints.split(","); for (final String contactPoint : splitContactPoints) { if (contactPoint.contains(":")) { final String[] address = contactPoint.split(":"); clusterBuilder.addContactPointsWithPorts( new InetSocketAddress(address[0].trim(), Integer.valueOf(address[1].trim()))); } else { try { clusterBuilder.addContactPoints(InetAddress.getByName(contactPoint.trim())); } catch (final UnknownHostException uhex) { throw new IllegalArgumentException("Host not found!", uhex); } } } } private  ContactPointUtils(); static void process(final Cluster.Builder clusterBuilder, final String contactPoints);  }### Answer:
@Test public void shouldAddSimpleContactPoints() { final String contactPoints = "127.0.0.1,127.0.0.2,127.0.0.3"; final Cluster.Builder clusterBuilder = Cluster.builder(); ContactPointUtils.process(clusterBuilder, contactPoints); final List<InetSocketAddress> addedClusterPoints = clusterBuilder.getContactPoints(); Assert.assertTrue(addedClusterPoints.size() == 3); for (final InetSocketAddress address : addedClusterPoints) { Assert.assertTrue(contactPoints.contains(address.getAddress().getHostAddress())); } }
@Test public void shouldAddComplexContactPoints() { final String contactPoints = "127.0.0.1:1234,127.0.0.2:2345,127.0.0.3:3456"; final Cluster.Builder clusterBuilder = Cluster.builder(); ContactPointUtils.process(clusterBuilder, contactPoints); final List<InetSocketAddress> addedClusterPoints = clusterBuilder.getContactPoints(); Assert.assertTrue(addedClusterPoints.size() == 3); final InetSocketAddress firstAddress = addedClusterPoints.get(0); Assert.assertEquals("127.0.0.1", firstAddress.getAddress().getHostAddress()); Assert.assertEquals(1234, firstAddress.getPort()); final InetSocketAddress secondAddress = addedClusterPoints.get(1); Assert.assertEquals("127.0.0.2", secondAddress.getAddress().getHostAddress()); Assert.assertEquals(2345, secondAddress.getPort()); final InetSocketAddress thirdAddress = addedClusterPoints.get(2); Assert.assertEquals("127.0.0.3", thirdAddress.getAddress().getHostAddress()); Assert.assertEquals(3456, thirdAddress.getPort()); }