public static ServiceResourceProvider getServiceProvider(
      AmbariManagementController managementController,
      MaintenanceStateHelper maintenanceStateHelper, RepositoryVersionDAO repositoryVersionDAO)
      throws NoSuchFieldException, IllegalAccessException {
    Resource.Type type = Resource.Type.Service;
    ServiceResourceProvider serviceResourceProvider =
        new ServiceResourceProvider(managementController, maintenanceStateHelper, repositoryVersionDAO);

    Field STOMPComponentsDeleteHandlerField = ServiceResourceProvider.class.getDeclaredField("STOMPComponentsDeleteHandler");
    STOMPComponentsDeleteHandlerField.setAccessible(true);
    STOMPComponentsDeleteHandler STOMPComponentsDeleteHandler = createNiceMock(STOMPComponentsDeleteHandler.class);
    STOMPComponentsDeleteHandlerField.set(serviceResourceProvider, STOMPComponentsDeleteHandler);
    replay(STOMPComponentsDeleteHandler);
    return serviceResourceProvider;
  }
This factory method allows to define custom MaintenanceStateHelper mock.
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java