Source:
public void testFilterByTagsBeforeTagChange() throws Exception { for (Map.Entry<String, String> apiTagEntry : apiTagsMapBeforeChange.entrySet()) { String apiName = apiTagEntry.getKey(); String apiTags = apiTagEntry.getValue(); String apiContext = apiName.toLowerCase(); APIIdentifier apiIdentifier = new APIIdentifier(providerName, apiName, API_VERSION_1_0_0); APICreationRequestBean apiCreationRequestBean = new APICreationRequestBean(apiName, apiContext, API_VERSION_1_0_0, new URL(API_END_POINT_URL)); apiCreationRequestBean.setTags(apiTags); apiCreationRequestBean.setDescription(API_DESCRIPTION); createAndPublishAPIWithoutRequireReSubscription(apiIdentifier, apiCreationRequestBean, apiPublisherClientUser1); } HttpResponse apiPageFilteredWithTagsResponse = apiStoreClientUser1.getAPIPageFilteredWithTags("Tag3"); assertEquals(apiPageFilteredWithTagsResponse.getResponseCode(), HTTP_RESPONSE_CODE_OK, ""); String apiPageFilteredWithTagsResponseString = apiPageFilteredWithTagsResponse.getData(); for (Map.Entry<String, String> apiTagEntry : apiTagsMapBeforeChange.entrySet()) { String apiLinkToTestInPage = "/store/apis/info?name=" + apiTagEntry.getKey() + "&version=" + API_VERSION_1_0_0 + "&provider=" + providerName + "&tenant=carbon.super&tag=" + TEST_TAG + ""; if (apiTagEntry.getValue().contains(TEST_TAG)) { assertTrue(apiPageFilteredWithTagsResponseString.contains(apiLinkToTestInPage), "API is not listed with correct tag, API:" + apiTagEntry.getKey() + " Tag:" + TEST_TAG); } else { assertFalse(apiPageFilteredWithTagsResponseString.contains(apiLinkToTestInPage), "API is listed with incorrect tag, API:" + apiTagEntry.getKey() + " Tag:" + TEST_TAG); } } }

Target:
public void testFilterByTagsBeforeTagChange() throws APIManagerIntegrationTestException, MalformedURLException { for (Map.Entry<String, String> apiTagEntry : apiTagsMapBeforeChange.entrySet()) { String apiName = apiTagEntry.getKey(); String apiTags = apiTagEntry.getValue(); String apiContext = apiName.toLowerCase(); APIIdentifier apiIdentifier = new APIIdentifier(providerName, apiName, API_VERSION_1_0_0); APICreationRequestBean apiCreationRequestBean = new APICreationRequestBean(apiName, apiContext, API_VERSION_1_0_0, providerName, new URL(API_END_POINT_URL)); apiCreationRequestBean.setTags(apiTags); apiCreationRequestBean.setDescription(API_DESCRIPTION); createAndPublishAPIWithoutRequireReSubscription(apiIdentifier, apiCreationRequestBean, apiPublisherClientUser1); } HttpResponse apiPageFilteredWithTagsResponse = apiStoreClientUser1.getAPIPageFilteredWithTags(TEST_TAG); assertEquals(apiPageFilteredWithTagsResponse.getResponseCode(), HTTP_RESPONSE_CODE_OK, "Response code wan not" + " Ok:200 for retrieving the API page filtered with tags"); String apiPageFilteredWithTagsResponseString = apiPageFilteredWithTagsResponse.getData(); for (Map.Entry<String, String> apiTagEntry : apiTagsMapBeforeChange.entrySet()) { String apiLinkToTestInPage = "/store/apis/info?name=" + apiTagEntry.getKey() + "&version=" + API_VERSION_1_0_0 + "&provider=" + providerName + "&tenant=carbon.super&tag=" + TEST_TAG + ""; if (apiTagEntry.getValue().contains(TEST_TAG)) { assertTrue(apiPageFilteredWithTagsResponseString.contains(apiLinkToTestInPage), "API is not listed with correct tag, API:" + apiTagEntry.getKey() + " Tag:" + TEST_TAG); } else { assertFalse(apiPageFilteredWithTagsResponseString.contains(apiLinkToTestInPage), "API is listed with incorrect tag, API:" + apiTagEntry.getKey() + " Tag:" + TEST_TAG); } } }