### Question:
EventUtils { public static String getHS2ConnectionUrl(final String hs2Uri, final String database, final String authTokenString, final String hs2UriExtraOpts) { StringBuilder connString = new StringBuilder(); connString.append(JDBC_PREFIX).append(StringUtils.removeEnd(hs2Uri, "/")).append("/").append(database); if (StringUtils.isNotBlank(authTokenString)) { connString.append(authTokenString); } if (StringUtils.isNotBlank(hs2UriExtraOpts) && !("NA".equalsIgnoreCase(hs2UriExtraOpts))) { if (!hs2UriExtraOpts.startsWith(";")) { connString.append(";"); } connString.append(hs2UriExtraOpts); } LOG.info("getHS2ConnectionUrl connection uri: {}", connString); return connString.toString(); } EventUtils(Configuration conf); void setupConnection(); static String getHS2ConnectionUrl(final String hs2Uri, final String database,
                                             final String authTokenString, final String hs2UriExtraOpts); void initializeFS(); void processEvents(String event); List<ReplicationStatus> getListReplicationStatus(); void invokeCopy(); DistCpOptions getDistCpOptions(); Long getCounterValue(String counterKey); boolean isCountersMapEmpty(); void cleanEventsDirectory(); void closeConnection();  }### Answer:
@Test public void validateHs2Uri() { final String expectedUri = JDBC_PREFIX + HS2_URI + "/" + DATABASE; Assert.assertEquals(EventUtils.getHS2ConnectionUrl(HS2_URI, DATABASE, null, null), expectedUri); Assert.assertEquals(EventUtils.getHS2ConnectionUrl(HS2_URI, DATABASE, null, "NA"), expectedUri); Assert.assertEquals(EventUtils.getHS2ConnectionUrl(HS2_URI, DATABASE, AUTHTOKEN_STRING, null), expectedUri + AUTHTOKEN_STRING); }
@Test public void validateHs2UriWhenSSLEnabled() { final String expectedUri = JDBC_PREFIX + HS2_URI + "/" + DATABASE; Assert.assertEquals(EventUtils.getHS2ConnectionUrl(HS2_URI, DATABASE, null, HS2_SSL_EXTRA_OPTS), expectedUri + ";" + HS2_SSL_EXTRA_OPTS); Assert.assertEquals(EventUtils.getHS2ConnectionUrl(HS2_URI, DATABASE, AUTHTOKEN_STRING, HS2_SSL_EXTRA_OPTS), expectedUri + AUTHTOKEN_STRING + ";" + HS2_SSL_EXTRA_OPTS); }
@Test public void validateHs2UriWhenZKDiscoveryEnabled() { final String expectedUri = JDBC_PREFIX + HS2_ZK_URI + DATABASE; Assert.assertEquals(EventUtils.getHS2ConnectionUrl(HS2_ZK_URI, DATABASE, null, HS2_ZK_EXTRA_OPTS), expectedUri + HS2_ZK_EXTRA_OPTS); Assert.assertEquals(EventUtils.getHS2ConnectionUrl(HS2_ZK_URI, DATABASE, AUTHTOKEN_STRING, HS2_ZK_EXTRA_OPTS), expectedUri + AUTHTOKEN_STRING + HS2_ZK_EXTRA_OPTS); }