AutocompletionAgent { public List<String> getSchemaMetadataList(String lookupSchemaMetadataName, List<String> schemaGroupList, List<String> schemaMetadataList) { List<String> res = schemaMetadataList; Collection<String> schemas = client.getSchemaNames(schemaGroupList); schemas.forEach(sName -> { if (!res.contains(sName) && sName.contains(lookupSchemaMetadataName)) { res.add(sName); } }); return res; } AutocompletionAgent(String serviceName, Map<String, String> configs);  AutocompletionAgent(String serviceName, ISchemaRegistryClient client); HashMap<String, Object> connectionTest(); List<String> getSchemaGroupList(String lookupGroupName, List<String> groupList); List<String> getSchemaMetadataList(String lookupSchemaMetadataName,
                                              List<String> schemaGroupList,
                                              List<String> schemaMetadataList); List<String> getBranchList(String lookupBranchName,
                                      List<String> groupList,
                                      List<String> schemaList,
                                      List<String> branchList); @Override String toString();  }
@Test public void getSchemaMetadataList() { ISchemaRegistryClient client = new DefaultSchemaRegistryClientForTesting(){ public List<String> getSchemaNames(List<String> schemaGroup) { if(!schemaGroup.contains("Group1")) { return new ArrayList<>(); } List<String> schemas = new ArrayList<>(); schemas.add("testSchema"); return schemas; } }; AutocompletionAgent autocompletionAgent = new AutocompletionAgent("schema-registry", client); List<String> groupList = new ArrayList<>(); groupList.add("Group1"); groupList.add("Group2"); List<String> res = autocompletionAgent.getSchemaMetadataList("tes", groupList, new ArrayList<>()); List<String> expected = new ArrayList<>(); expected.add("testSchema"); assertEquals(1, res.size()); assertThat(res, is(expected)); res = autocompletionAgent.getSchemaMetadataList("tesSome", groupList, new ArrayList<>()); assertEquals(0, res.size()); }