@Before
  public void setup() throws Exception {

    m_clusters = EasyMock.createMock(Clusters.class);
    UnitOfWork unitOfWork = EasyMock.createMock(UnitOfWork.class);

    Map<String, String> mockProperties = new HashMap<String, String>() {{
      put("kerberos-env", "");
    }};

    m_kerberosConfig = EasyMock.createNiceMock(Config.class);
    expect(m_kerberosConfig.getType()).andReturn("kerberos-env").anyTimes();
    expect(m_kerberosConfig.getProperties()).andReturn(mockProperties).anyTimes();

    Cluster cluster = EasyMock.createMock(Cluster.class);

    expect(cluster.getDesiredConfigByType("kerberos-env")).andReturn(m_kerberosConfig).atLeastOnce();
    expect(cluster.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes();
    expect(m_clusters.getCluster((String) anyObject())).andReturn(cluster).anyTimes();

    replay(m_clusters, cluster, m_kerberosConfig);

    m_injector = Guice.createInjector(new AbstractModule() {

      @Override
      protected void configure() {
        PartialNiceMockBinder.newBuilder().addClustersBinding().addLdapBindings().build().configure(binder());

        bind(Clusters.class).toInstance(m_clusters);
        bind(OsFamily.class).toInstance(EasyMock.createNiceMock(OsFamily.class));
        bind(UpgradeHelper.class).toInstance(EasyMock.createNiceMock(UpgradeHelper.class));
        bind(StackManagerFactory.class).toInstance(EasyMock.createNiceMock(StackManagerFactory.class));
        bind(StackDAO.class).toInstance(EasyMock.createNiceMock(StackDAO.class));
        bind(EntityManager.class).toInstance(EasyMock.createNiceMock(EntityManager.class));
        bind(DBAccessor.class).toInstance(EasyMock.createNiceMock(DBAccessor.class));
        bind(AmbariMetaInfo.class).toInstance(EasyMock.createNiceMock(AmbariMetaInfo.class));
        bind(MpackManagerFactory.class).toInstance(createNiceMock(MpackManagerFactory.class));
      }
    });

    m_kerberosHelper = m_injector.getInstance(KerberosHelper.class);
  }
Tests upgrade-related server side actions
ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java