IdolFindConfig extends AbstractConfig<IdolFindConfig> implements UserServiceConfig, IdolSearchCapable, FindConfig<IdolFindConfig, IdolFindConfigBuilder>, PasswordsConfig<IdolFindConfig> { @Override public IdolFindConfig merge(final IdolFindConfig maybeOther) { return Optional.ofNullable(maybeOther) .map(other -> builder() .content(content == null ? other.content : content.merge(other.content)) .referenceField(referenceField == null ? other.referenceField : referenceField) .login(login == null ? other.login : login.merge(other.login)) .queryManipulation(queryManipulation == null ? other.queryManipulation : queryManipulation.merge(other.queryManipulation)) .view(view == null ? other.view : view.merge(other.view)) .answerServer(answerServer == null ? other.answerServer : answerServer.merge(other.answerServer)) .entitySearch(entitySearch == null ? other.entitySearch : entitySearch.merge(other.entitySearch)) .controlPoint(controlPoint == null ? other.controlPoint : controlPoint.merge(other.controlPoint)) .savedSearchConfig(savedSearchConfig == null ? other.savedSearchConfig : savedSearchConfig.merge(other.savedSearchConfig)) .mmap(mmap == null ? other.mmap : mmap.merge(other.mmap)) .messageOfTheDay(messageOfTheDay == null ? other.messageOfTheDay : messageOfTheDay.merge(other.messageOfTheDay)) .uiCustomization(uiCustomization == null ? other.uiCustomization : uiCustomization.merge(other.uiCustomization)) .idolFieldPathNormalizerXMLPrefixes(CollectionUtils.isEmpty(idolFieldPathNormalizerXMLPrefixes) ? other.idolFieldPathNormalizerXMLPrefixes : idolFieldPathNormalizerXMLPrefixes) .fieldsInfo(fieldsInfo == null ? other.fieldsInfo : fieldsInfo.merge(other.fieldsInfo)) .sunburst(sunburst == null ? other.sunburst : sunburst.merge(other.sunburst)) .map(map == null ? other.map : map.merge(other.map)) .trending(trending == null ? other.trending : trending.merge(other.trending)) .themeTracker(themeTracker == null ? other.themeTracker : themeTracker.merge(other.themeTracker)) .combineMethod(combineMethod == null ? other.combineMethod : combineMethod) .minScore(minScore == null ? other.minScore : minScore) .statsServer(statsServer == null ? other.statsServer : statsServer.merge(other.statsServer)) .topicMapMaxResults(topicMapMaxResults == null ? other.topicMapMaxResults : topicMapMaxResults) .storedStateField(storedStateField == null ? other.storedStateField : storedStateField) .comparisonStoreStateMaxResults(comparisonStoreStateMaxResults == null ? other.comparisonStoreStateMaxResults : comparisonStoreStateMaxResults) .exportStoreStateMaxResults(exportStoreStateMaxResults == null ? other.exportStoreStateMaxResults : exportStoreStateMaxResults) .documentSummaryMaxLength(documentSummaryMaxLength == null ? other.documentSummaryMaxLength : documentSummaryMaxLength) .export(Optional.ofNullable(export).map(exportConfig -> exportConfig.merge(maybeOther.export)).orElse(maybeOther.export)) .build()) .orElse(this); }  @Override IdolFindConfig merge(final IdolFindConfig maybeOther); @Override Map<String, OptionalConfigurationComponent<?>> getValidationMap(); @JsonIgnore @Override AciServerDetails getCommunityDetails(); @JsonIgnore @Override Authentication<?> getAuthentication(); @Override IdolFindConfig withoutDefaultLogin(); @Override IdolFindConfig generateDefaultLogin(); @Override IdolFindConfig withHashedPasswords(); @Override IdolFindConfig withoutPasswords(); @Override IdolFindConfig withEncryptedPasswords(final TextEncryptor encryptor); @Override IdolFindConfig withDecryptedPasswords(final TextEncryptor encryptor); @Override void basicValidate(final String section); @JsonIgnore @Override AciServerDetails getContentAciServerDetails(); @Override @JsonIgnore ViewConfig getViewConfig(); @Override String lookupComponentNameByHostAndPort(final String hostName, final int port);  }
@Test public void merge() { when(serverConfig.merge(any(ServerConfig.class))).thenReturn(serverConfig); when(communityAuthentication.merge(any(CommunityAuthentication.class))).thenReturn(communityAuthentication); when(queryManipulation.merge(any(QueryManipulation.class))).thenReturn(queryManipulation); when(savedSearchConfig.merge(any(SavedSearchConfig.class))).thenReturn(savedSearchConfig); when(viewConfig.merge(any(ViewConfig.class))).thenReturn(viewConfig); when(export.merge(any(ExportConfig.class))).thenReturn(export); when(trending.merge(any(TrendingConfiguration.class))).thenReturn(trending); when(themeTracker.merge(any(ThemeTrackerConfig.class))).thenReturn(themeTracker); final IdolFindConfig defaults = IdolFindConfig.builder().content(mock(ServerConfig.class)).build(); final IdolFindConfig mergedConfig = idolFindConfig.merge(defaults); assertEquals(serverConfig, mergedConfig.getContent()); assertEquals(communityAuthentication, mergedConfig.getLogin()); assertEquals(queryManipulation, mergedConfig.getQueryManipulation()); assertEquals(savedSearchConfig, mergedConfig.getSavedSearchConfig()); assertEquals(viewConfig, mergedConfig.getViewConfig()); assertEquals(export, mergedConfig.getExport()); assertEquals(trending, mergedConfig.getTrending()); assertEquals(idolFindConfig, mergedConfig); assertEquals(themeTracker, mergedConfig.getThemeTracker()); }
@Test public void mergeWithNoDefaults() { assertNotNull(idolFindConfig.merge(null)); }