@Test
public void connectionTest() {

    ISchemaRegistryClient client = new DefaultSchemaRegistryClientForTesting();
    AutocompletionAgent autocompletionAgent =
            new AutocompletionAgent("schema-registry", client);
    HashMap<String, Object> res = autocompletionAgent.connectionTest();
    assertEquals(res.get("connectivityStatus"), true);
    assertEquals(res.get("message"), "ConnectionTest Successful");
    assertEquals(res.get("description"), "ConnectionTest Successful");
    assertNull(res.get("objectId"));
    assertNull(res.get("fieldName"));
    client = new DefaultSchemaRegistryClientForTesting() {
        public void checkConnection() throws Exception {
            throw new Exception("Cannot connect to the SR server");
        }
    };
    autocompletionAgent =
            new AutocompletionAgent("schema-registry", client);
    res = autocompletionAgent.connectionTest();
    String errMessage = "You can still save the repository and start creating "
            + "policies, but you would not be able to use autocomplete for "
            + "resource names. Check server logs for more info.";
    assertEquals(res.get("connectivityStatus"), false);
    assertThat(res.get("message"), is(errMessage));
    assertThat(res.get("description"), is(errMessage));
    assertNull(res.get("objectId"));
    assertNull(res.get("fieldName"));
}