UpgradeCatalog242 extends AbstractUpgradeCatalog { @Override protected void executeDMLUpdates() throws AmbariException, SQLException { addNewConfigurationsFromXml(); createRoleAuthorizations(); convertRolePrincipals(); } @Inject  UpgradeCatalog242(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion();  }
@Test public void testExecuteDMLUpdates() throws Exception { Method addNewConfigurationsFromXml = AbstractUpgradeCatalog.class.getDeclaredMethod("addNewConfigurationsFromXml"); Method convertRolePrincipals = UpgradeCatalog242.class.getDeclaredMethod("convertRolePrincipals"); Method createRoleAuthorizations = UpgradeCatalog242.class.getDeclaredMethod("createRoleAuthorizations"); UpgradeCatalog242 upgradeCatalog242 = createMockBuilder(UpgradeCatalog242.class) .addMockedMethod(addNewConfigurationsFromXml) .addMockedMethod(convertRolePrincipals) .addMockedMethod(createRoleAuthorizations) .createMock(); upgradeCatalog242.addNewConfigurationsFromXml(); expectLastCall().once(); upgradeCatalog242.createRoleAuthorizations(); expectLastCall().once(); upgradeCatalog242.convertRolePrincipals(); expectLastCall().once(); replay(upgradeCatalog242); upgradeCatalog242.executeDMLUpdates(); verify(upgradeCatalog242); }