/** * Creates global tag categories. * * @param categoryVO the category value objects * @throws Exception an exception occurred */ @Test( groups = {"globalTagCategories"}, dataProvider = "globalTagCategories") public void createGlobalTagCategory(GlobalTagCategoryVO categoryVO) throws Exception { TagCategoryManagement tm = ServiceLocator.findService(TagCategoryManagement.class); LOG.debug("create global tag category: " + categoryVO.getPrefix()); GlobalTagCategory category = tm.createGlobalTagCategory(categoryVO); checkTagCategoryData(categoryVO, category); }
/** * Checks if the given tag category entity equals to the tag category value object. * * @param expected the expected values * @param actual the actual values */ private void checkTagCategoryData(GlobalTagCategoryVO expected, GlobalTagCategory actual) { ToStringBuilder s1 = new ToStringBuilder(ToStringStyle.MULTI_LINE_STYLE) .append("description", actual.getDescription()) .append("name", actual.getName()) .append("prefix", actual.getPrefix()); boolean result = true; result = result && StringUtils.equals(expected.getDescription(), actual.getDescription()); result = result && StringUtils.equals(expected.getName(), actual.getName()); result = result && StringUtils.equals(expected.getPrefix(), actual.getPrefix()); Assert.assertEquals( result, true, "value object and entity not equal, entity: " + s1.toString() + ", source vo: " + ToStringBuilder.reflectionToString(expected, ToStringStyle.MULTI_LINE_STYLE)); }