test_class.declarator: tagDaoHelper
test_class.modifier: @InjectMocks
      private
test_class.original_string: @InjectMocks
      private TagDaoHelper tagDaoHelper;
test_class.type: TagDaoHelper
test_class.var_name: tagDaoHelper
test_class.declarator: configurationHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ConfigurationHelper configurationHelper;
test_class.type: ConfigurationHelper
test_class.var_name: configurationHelper
test_class.declarator: tagDao
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private TagDao tagDao;
test_class.type: TagDao
test_class.var_name: tagDao
test_class.file: herd-code/herd-dao/src/test/java/org/finra/herd/dao/helper/TagDaoHelperTest.java
test_class.identifier: TagDaoHelperTest
test_class.superclass: extends AbstractDaoTest
test_case.body: @Test
      public void testValidateParentTagEntityWithTagEntityEqualToParentTagEntity()
      {
          // 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);
  
          // Setup when clauses
          when(configurationHelper.getProperty(ConfigurationValue.MAX_ALLOWED_TAG_NESTING, Integer.class)).thenReturn(0);
  
          // Call the method under test
          try
          {
              tagDaoHelper.validateParentTagEntity(tagEntity, tagEntity);
              fail("Expected to throw an exception.");
          }
          catch (IllegalArgumentException illegalArgumentException)
          {
              // Confirm the exception message is correct
              assertThat("Exception message is not correct.", illegalArgumentException.getMessage(),
                  is(equalTo("Parent tag key cannot be the requested tag key or any of its children’s tag keys.")));
          }
  
          // Setup verify clauses
          verify(configurationHelper).getProperty(ConfigurationValue.MAX_ALLOWED_TAG_NESTING, Integer.class);
          verifyNoMoreInteractions(configurationHelper, tagDao);
      }
test_case.class_method_signature: TagDaoHelperTest.testValidateParentTagEntityWithTagEntityEqualToParentTagEntity()
test_case.full_signature: @Test public void testValidateParentTagEntityWithTagEntityEqualToParentTagEntity()
test_case.identifier: testValidateParentTagEntityWithTagEntityEqualToParentTagEntity
test_case.invocations: setCode setTagType setTagCode setDisplayName thenReturn when getProperty validateParentTagEntity fail assertThat getMessage is equalTo getProperty verify verifyNoMoreInteractions
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidateParentTagEntityWithTagEntityEqualToParentTagEntity()
focal_class.declarator: configurationHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ConfigurationHelper configurationHelper;
focal_class.type: ConfigurationHelper
focal_class.var_name: configurationHelper
focal_class.declarator: tagDao
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private TagDao tagDao;
focal_class.type: TagDao
focal_class.var_name: tagDao
focal_class.file: herd-code/herd-dao/src/main/java/org/finra/herd/dao/helper/TagDaoHelper.java
focal_class.identifier: TagDaoHelper
focal_class.class_method_signature: TagDaoHelper.assertDisplayNameDoesNotExistForTag(String tagCode, String displayName)
focal_class.full_signature: public void assertDisplayNameDoesNotExistForTag(String tagCode, String displayName)
focal_class.identifier: assertDisplayNameDoesNotExistForTag
focal_class.modifiers: public
focal_class.parameters: (String tagCode, String displayName)
focal_class.return: void
focal_class.signature: void assertDisplayNameDoesNotExistForTag(String tagCode, String displayName)
focal_class.class_method_signature: TagDaoHelper.getTagChildrenEntities(TagEntity parentTagEntity)
focal_class.full_signature: public List<TagEntity> getTagChildrenEntities(TagEntity parentTagEntity)
focal_class.identifier: getTagChildrenEntities
focal_class.modifiers: public
focal_class.parameters: (TagEntity parentTagEntity)
focal_class.return: List<TagEntity>
focal_class.signature: List<TagEntity> getTagChildrenEntities(TagEntity parentTagEntity)
focal_class.class_method_signature: TagDaoHelper.getTagEntity(TagKey tagKey)
focal_class.full_signature: public TagEntity getTagEntity(TagKey tagKey)
focal_class.identifier: getTagEntity
focal_class.modifiers: public
focal_class.parameters: (TagKey tagKey)
focal_class.return: TagEntity
focal_class.signature: TagEntity getTagEntity(TagKey tagKey)
focal_class.class_method_signature: TagDaoHelper.validateParentTagEntity(TagEntity tagEntity, TagEntity parentTagEntity)
focal_class.full_signature: public void validateParentTagEntity(TagEntity tagEntity, TagEntity parentTagEntity)
focal_class.identifier: validateParentTagEntity
focal_class.modifiers: public
focal_class.parameters: (TagEntity tagEntity, TagEntity parentTagEntity)
focal_class.return: void
focal_class.signature: void validateParentTagEntity(TagEntity tagEntity, TagEntity parentTagEntity)
focal_class.class_method_signature: TagDaoHelper.validateParentTagType(String tagTypeCode, String parentTagTypeCode)
focal_class.full_signature: public void validateParentTagType(String tagTypeCode, String parentTagTypeCode)
focal_class.identifier: validateParentTagType
focal_class.modifiers: public
focal_class.parameters: (String tagTypeCode, String parentTagTypeCode)
focal_class.return: void
focal_class.signature: void validateParentTagType(String tagTypeCode, String parentTagTypeCode)
focal_method.body: public void validateParentTagEntity(TagEntity tagEntity, TagEntity parentTagEntity)
      {
          Integer maxAllowedTagNesting = configurationHelper.getProperty(ConfigurationValue.MAX_ALLOWED_TAG_NESTING, Integer.class);
  
          TagEntity localParentTagEntity = parentTagEntity;
          int level = 0;
          while (localParentTagEntity != null)
          {
              Assert.isTrue(!tagEntity.equals(localParentTagEntity), "Parent tag key cannot be the requested tag key or any of its children’s tag keys.");
              localParentTagEntity = localParentTagEntity.getParentTagEntity();
              if (level++ >= maxAllowedTagNesting)
              {
                  throw new IllegalArgumentException("Exceeds maximum allowed tag nesting level of " + maxAllowedTagNesting);
              }
          }
      }
focal_method.class_method_signature: TagDaoHelper.validateParentTagEntity(TagEntity tagEntity, TagEntity parentTagEntity)
focal_method.full_signature: public void validateParentTagEntity(TagEntity tagEntity, TagEntity parentTagEntity)
focal_method.identifier: validateParentTagEntity
focal_method.invocations: getProperty isTrue equals getParentTagEntity
focal_method.modifiers: public
focal_method.parameters: (TagEntity tagEntity, TagEntity parentTagEntity)
focal_method.return: void
focal_method.signature: void validateParentTagEntity(TagEntity tagEntity, TagEntity parentTagEntity)