### Question:
UpgradeCatalog272 extends AbstractUpgradeCatalog { protected int renameLdapSynchCollisionBehaviorValue() throws SQLException { int numberOfRecordsRenamed = 0; if (dbAccessor.tableExists(AMBARI_CONFIGURATION_TABLE)) { LOG.debug("Executing: {}", RENAME_COLLISION_BEHAVIOR_PROPERTY_SQL); numberOfRecordsRenamed = dbAccessor.executeUpdate(RENAME_COLLISION_BEHAVIOR_PROPERTY_SQL); LOG.info("Renamed {} {} with incorrect LDAP configuration property name", numberOfRecordsRenamed, 1 >= numberOfRecordsRenamed ? "record" : "records"); } else { LOG.info("{} table does not exists; nothing to update", AMBARI_CONFIGURATION_TABLE); } return numberOfRecordsRenamed; } @Inject  UpgradeCatalog272(Injector injector); @Override String getSourceVersion(); @Override String getTargetVersion();  }### Answer:
@Test public void shouldRenameCollisionBehaviorLdapCategoryPropertyNameIfTableWithDataExists() throws Exception { final int expectedResult = 3; expect(dbAccessor.tableExists(AMBARI_CONFIGURATION_TABLE)).andReturn(true).once(); expect(dbAccessor.executeUpdate(RENAME_COLLISION_BEHAVIOR_PROPERTY_SQL)).andReturn(expectedResult).once(); replay(dbAccessor); final UpgradeCatalog272 upgradeCatalog272 = new UpgradeCatalog272(injector); upgradeCatalog272.dbAccessor = dbAccessor; assertEquals(expectedResult, upgradeCatalog272.renameLdapSynchCollisionBehaviorValue()); verify(dbAccessor); }
@Test public void shouldNotRenameCollisionBehaviorLdapCategoryPropertyNameIfTableDoesNotExist() throws Exception { final int expectedResult = 0; expect(dbAccessor.tableExists(AMBARI_CONFIGURATION_TABLE)).andReturn(false).once(); replay(dbAccessor); final UpgradeCatalog272 upgradeCatalog272 = new UpgradeCatalog272(injector); upgradeCatalog272.dbAccessor = dbAccessor; assertEquals(expectedResult, upgradeCatalog272.renameLdapSynchCollisionBehaviorValue()); verify(dbAccessor); }