test_class.declarator: alternateKeyHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private AlternateKeyHelper alternateKeyHelper;
test_class.type: AlternateKeyHelper
test_class.var_name: alternateKeyHelper
test_class.declarator: jsonHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private JsonHelper jsonHelper;
test_class.type: JsonHelper
test_class.var_name: jsonHelper
test_class.declarator: tagHelper
test_class.modifier: @InjectMocks
      private
test_class.original_string: @InjectMocks
      private TagHelper tagHelper;
test_class.type: TagHelper
test_class.var_name: tagHelper
test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/TagHelperTest.java
test_class.identifier: TagHelperTest
test_class.superclass: extends AbstractServiceTest
test_case.body: @Test
      public void testExecuteFunctionForTagEntities()
      {
          // Create a list of tag entities.
          final List<TagEntity> tagEntities = Collections.unmodifiableList(Arrays
              .asList(tagDaoTestHelper.createTagEntity(TAG_TYPE, TAG_CODE, TAG_DISPLAY_NAME, TAG_DESCRIPTION),
                  tagDaoTestHelper.createTagEntity(TAG_TYPE_2, TAG_CODE_2, TAG_DISPLAY_NAME_2, TAG_DESCRIPTION_2)));
  
          // Mock the external calls.
          when(jsonHelper.objectToJson(any())).thenReturn(JSON_STRING);
  
          // Execute a function for all tag entities.
          tagHelper.executeFunctionForTagEntities(SEARCH_INDEX_NAME, tagEntities, (indexName, id, json) -> { });
  
          // Verify the external calls.
          verify(jsonHelper, times(tagEntities.size())).objectToJson(any());
          verifyNoMoreInteractions(alternateKeyHelper, jsonHelper);
      }
test_case.class_method_signature: TagHelperTest.testExecuteFunctionForTagEntities()
test_case.full_signature: @Test public void testExecuteFunctionForTagEntities()
test_case.identifier: testExecuteFunctionForTagEntities
test_case.invocations: unmodifiableList asList createTagEntity createTagEntity thenReturn when objectToJson any executeFunctionForTagEntities objectToJson verify times size any verifyNoMoreInteractions
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExecuteFunctionForTagEntities()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(TagHelper.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(TagHelper.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: alternateKeyHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private AlternateKeyHelper alternateKeyHelper;
focal_class.type: AlternateKeyHelper
focal_class.var_name: alternateKeyHelper
focal_class.declarator: jsonHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private JsonHelper jsonHelper;
focal_class.type: JsonHelper
focal_class.var_name: jsonHelper
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/TagHelper.java
focal_class.identifier: TagHelper
focal_class.class_method_signature: TagHelper.executeFunctionForTagEntities(final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)
focal_class.full_signature: public void executeFunctionForTagEntities(final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)
focal_class.identifier: executeFunctionForTagEntities
focal_class.modifiers: public
focal_class.parameters: (final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)
focal_class.return: void
focal_class.signature: void executeFunctionForTagEntities(final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)
focal_class.class_method_signature: TagHelper.safeObjectMapperWriteValueAsString(final TagEntity tagEntity)
focal_class.full_signature: public String safeObjectMapperWriteValueAsString(final TagEntity tagEntity)
focal_class.identifier: safeObjectMapperWriteValueAsString
focal_class.modifiers: public
focal_class.parameters: (final TagEntity tagEntity)
focal_class.return: String
focal_class.signature: String safeObjectMapperWriteValueAsString(final TagEntity tagEntity)
focal_class.class_method_signature: TagHelper.validateTagKey(TagKey tagKey)
focal_class.full_signature: public void validateTagKey(TagKey tagKey)
focal_class.identifier: validateTagKey
focal_class.modifiers: public
focal_class.parameters: (TagKey tagKey)
focal_class.return: void
focal_class.signature: void validateTagKey(TagKey tagKey)
focal_method.body: public void executeFunctionForTagEntities(final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)
      {
          // For each tag apply the passed in function
          tagEntities.forEach(tagEntity -> {
              // Fetch Join with .size()
              tagEntity.getChildrenTagEntities().size();
  
              // Convert the tag entity to a JSON string
              final String jsonString = safeObjectMapperWriteValueAsString(tagEntity);
  
              if (StringUtils.isNotEmpty(jsonString))
              {
                  // Call the function that will process each tag entity against the index
                  try
                  {
                      function.accept(indexName, tagEntity.getId().toString(), jsonString);
                  }
                  catch (Exception ex)
                  {
                      LOGGER.warn("Index operation exception is logged {} for {}, {}, {}", ex, indexName, tagEntity.getId().toString(), jsonString);
                  }
              }
          });
  
          LOGGER.info("Finished processing {} tags with a search index function.", tagEntities.size());
      }
focal_method.class_method_signature: TagHelper.executeFunctionForTagEntities(final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)
focal_method.full_signature: public void executeFunctionForTagEntities(final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)
focal_method.identifier: executeFunctionForTagEntities
focal_method.invocations: forEach size getChildrenTagEntities safeObjectMapperWriteValueAsString isNotEmpty accept toString getId warn toString getId info size
focal_method.modifiers: public
focal_method.parameters: (final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)
focal_method.return: void
focal_method.signature: void executeFunctionForTagEntities(final String indexName, final List<TagEntity> tagEntities,
          final TriConsumer<String, String, String> function)