BusinessObjectDefinitionHelper { public void processTagSearchScoreMultiplier(final BusinessObjectDefinitionEntity businessObjectDefinitionEntity) { LOGGER.debug("processTagSearchScoreMultiplier " + businessObjectDefinitionEntity.getId() + " " + businessObjectDefinitionEntity.getBusinessObjectDefinitionTags()); BigDecimal totalSearchScoreMultiplier = businessObjectDefinitionEntity.getBusinessObjectDefinitionTags().stream().filter(item -> item.getTag().getSearchScoreMultiplier() != null) .reduce(BigDecimal.ONE, (bd, item) -> bd.multiply(item.getTag().getSearchScoreMultiplier()), BigDecimal::multiply) .setScale(3, RoundingMode.HALF_UP); businessObjectDefinitionEntity.setTagSearchScoreMultiplier(totalSearchScoreMultiplier); }  String businessObjectDefinitionKeyToString(BusinessObjectDefinitionKey businessObjectDefinitionKey); void executeFunctionForBusinessObjectDefinitionEntities(final String indexName,
        final List<BusinessObjectDefinitionEntity> businessObjectDefinitionEntities, final TriConsumer<String, String, String> function); BusinessObjectDefinitionKey getBusinessObjectDefinitionKey(BusinessObjectDefinitionColumnKey businessObjectDefinitionColumnKey); void validateBusinessObjectDefinitionKey(BusinessObjectDefinitionKey key); String safeObjectMapperWriteValueAsString(final BusinessObjectDefinitionEntity businessObjectDefinitionEntity); void processTagSearchScoreMultiplier(final BusinessObjectDefinitionEntity businessObjectDefinitionEntity);  }
@Test public void testProcessTagSearchScoreMultiplier() { final BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoTestHelper .createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, businessObjectDefinitionServiceTestHelper.getNewAttributes2()); TagEntity tagEntity1 = tagDaoTestHelper.createTagEntity(TAG_TYPE, TAG_CODE, TAG_DISPLAY_NAME_2, TAG_SEARCH_SCORE_MULTIPLIER, TAG_DESCRIPTION, null); TagEntity tagEntity2 = tagDaoTestHelper.createTagEntity(TAG_TYPE, TAG_CODE, TAG_DISPLAY_NAME, TAG_SEARCH_SCORE_MULTIPLIER_NULL, TAG_DESCRIPTION, null); List<BusinessObjectDefinitionTagEntity> businessObjectDefinitionTagEntities = Arrays .asList(businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionEntity, tagEntity1), businessObjectDefinitionTagDaoTestHelper.createBusinessObjectDefinitionTagEntity(businessObjectDefinitionEntity, tagEntity2)); businessObjectDefinitionEntity.setBusinessObjectDefinitionTags(businessObjectDefinitionTagEntities); businessObjectDefinitionHelper.processTagSearchScoreMultiplier(businessObjectDefinitionEntity); assertEquals(businessObjectDefinitionEntity.getTagSearchScoreMultiplier(), TAG_SEARCH_SCORE_MULTIPLIER.setScale(3, RoundingMode.HALF_UP)); }
@Test public void testProcessTagSearchScoreMultiplierTagsEmpty() { final BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectDefinitionDaoTestHelper .createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, businessObjectDefinitionServiceTestHelper.getNewAttributes2()); List<BusinessObjectDefinitionTagEntity> businessObjectDefinitionTagEntities = new ArrayList<>(); businessObjectDefinitionEntity.setBusinessObjectDefinitionTags(businessObjectDefinitionTagEntities); businessObjectDefinitionHelper.processTagSearchScoreMultiplier(businessObjectDefinitionEntity); assertEquals(businessObjectDefinitionEntity.getTagSearchScoreMultiplier(), BigDecimal.ONE.setScale(3, RoundingMode.HALF_UP)); }