UpgradeCatalog300 extends AbstractUpgradeCatalog { @Override protected void executeDMLUpdates() throws AmbariException, SQLException { addNewConfigurationsFromXml(); showHcatDeletedUserMessage(); setStatusOfStagesAndRequests(); } @Inject  UpgradeCatalog300(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion();  }
@Test public void testExecuteDMLUpdates() throws Exception { Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml"); Method showHcatDeletedUserMessage = UpgradeCatalog300.class.getDeclaredMethod("showHcatDeletedUserMessage"); Method setStatusOfStagesAndRequests = UpgradeCatalog300.class.getDeclaredMethod("setStatusOfStagesAndRequests"); UpgradeCatalog300 upgradeCatalog300 = createMockBuilder(UpgradeCatalog300.class) .addMockedMethod(showHcatDeletedUserMessage) .addMockedMethod(addNewConfigurationsFromXml) .addMockedMethod(setStatusOfStagesAndRequests) .createMock(); upgradeCatalog300.addNewConfigurationsFromXml(); upgradeCatalog300.showHcatDeletedUserMessage(); upgradeCatalog300.setStatusOfStagesAndRequests(); replay(upgradeCatalog300); upgradeCatalog300.executeDMLUpdates(); verify(upgradeCatalog300); }