use of org.wso2.carbon.apimgt.core.models.Tag in project carbon-apimgt by wso2.
the class TagDAOImplIT method testGetTags.
@Test(description = "Get all tags")
public void testGetTags() throws APIManagementException {
// add tags by creating two different APIs
API api = TestUtil.addTestAPI();
API alternativeApi = TestUtil.addAlternativeAPI();
// get the list of all tags from DB
TagDAO tag = DAOFactory.getTagDAO();
List<Tag> tagList = tag.getTags();
Assert.assertNotNull(tagList);
// check tags for correctness
HashSet<String> set = new HashSet<>();
set.addAll(api.getTags());
set.addAll(alternativeApi.getTags());
List<String> tagsFromDB = new ArrayList<>();
for (Tag availableTag : tagList) {
tagsFromDB.add(availableTag.getName());
}
Assert.assertTrue(set.containsAll(tagsFromDB));
Assert.assertTrue(set.size() == tagsFromDB.size());
}
Aggregations