parentTagEntity.setTagCode(TAG_CODE_2); parentTagEntity.setDisplayName(TAG_DISPLAY_NAME_2); parentTagEntity.setChildrenTagEntities(Lists.newArrayList(tagEntity));
@Test public void testValidateParentTagEntity() { // Create a tag type entity TagTypeEntity tagTypeEntity = new TagTypeEntity(); tagTypeEntity.setCode(TAG_TYPE_CODE); // Create a tag entity TagEntity tagEntity = new TagEntity(); tagEntity.setTagType(tagTypeEntity); tagEntity.setTagCode(TAG_CODE); tagEntity.setDisplayName(TAG_DISPLAY_NAME); // Create a parent tag entity TagEntity parentTagEntity = new TagEntity(); parentTagEntity.setTagType(tagTypeEntity); parentTagEntity.setTagCode(TAG_CODE_2); parentTagEntity.setDisplayName(TAG_DISPLAY_NAME_2); parentTagEntity.setChildrenTagEntities(Lists.newArrayList(tagEntity)); // Set the parent tag entity on the child tag entity tagEntity.setParentTagEntity(parentTagEntity); // Setup when clauses when(configurationHelper.getProperty(ConfigurationValue.MAX_ALLOWED_TAG_NESTING, Integer.class)).thenReturn(1); // Call the method under test tagDaoHelper.validateParentTagEntity(tagEntity, parentTagEntity); // Setup verify clauses verify(configurationHelper).getProperty(ConfigurationValue.MAX_ALLOWED_TAG_NESTING, Integer.class); verifyNoMoreInteractions(configurationHelper, tagDao); }
childTagEntity.setParentTagEntity(tagEntity); tagEntity.setChildrenTagEntities(Lists.newArrayList(childTagEntity));