### Question:
UpgradeCatalog270 extends AbstractUpgradeCatalog { protected String updateMergeFactor(String content, String variableName) { return content.replaceAll("<mergeFactor>\\{\\{" + variableName + "\\}\\}</mergeFactor>", "<mergePolicyFactory class=\"org.apache.solr.index.TieredMergePolicyFactory\">\n" + " <int name=\"maxMergeAtOnce\">{{" + variableName + "}}</int>\n" + " <int name=\"segmentsPerTier\">{{" + variableName + "}}</int>\n" + " </mergePolicyFactory>"); } @Inject  UpgradeCatalog270(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); static final String[] COMPONENT_NAME_SERVICE_NAME_CLUSTER_ID_KEY_COLUMNS; static final String[] SERVICE_NAME_CLUSTER_ID_KEY_COLUMNS; static final String AMBARI_INFRA_OLD_NAME; static final String AMBARI_INFRA_NEW_NAME; static final String SERVICE_CONFIG_MAPPING_TABLE; static final String CLUSTER_CONFIG_TABLE; static final String FK_HOSTCOMPONENTDESIREDSTATE_COMPONENT_NAME; static final String FK_HOSTCOMPONENTSTATE_COMPONENT_NAME; static final String FK_SERVICECOMPONENTDESIREDSTATE_SERVICE_NAME; }### Answer:
@Test public void testupdateMergeFactor() throws Exception { String solrConfigXml = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("org/apache/ambari/server/upgrade/solrconfig-v500.xml.j2"), "UTF-8"); UpgradeCatalog270 upgradeCatalog270 = createMockBuilder(UpgradeCatalog270.class) .createMock(); replay(upgradeCatalog270); String updated = upgradeCatalog270.updateMergeFactor(solrConfigXml, "logsearch_service_logs_merge_factor"); assertThat(updated.contains("<int name=\"maxMergeAtOnce\">{{logsearch_service_logs_merge_factor}}</int>"), is(true)); assertThat(updated.contains("<int name=\"segmentsPerTier\">{{logsearch_service_logs_merge_factor}}</int>"), is(true)); assertThat(updated.contains("<mergeFactor>{{logsearch_service_logs_merge_factor}}</mergeFactor>"), is(false)); verify(upgradeCatalog270); }