LocatorClusterManagementService implements ClusterManagementService { @VisibleForTesting <R> List<R> cleanResults(List<?> functionResults) { List<R> results = new ArrayList<>(); for (Object functionResult : functionResults) { if (functionResult == null) { continue; } if (functionResult instanceof Throwable) { logger.warn("Error executing CacheRealizationFunction.", (Throwable) functionResult); continue; } results.add((R) functionResult); } return results; } LocatorClusterManagementService(InternalCache cache,
      InternalConfigurationPersistenceService persistenceService); @VisibleForTesting  LocatorClusterManagementService(
      InternalCache cache,
      InternalConfigurationPersistenceService persistenceService,
      Map<Class, ConfigurationManager> managers,
      Map<Class, ConfigurationValidator> validators,
      MemberValidator memberValidator,
      CommonConfigurationValidator commonValidator,
      OperationManager operationManager); @Override ClusterManagementRealizationResult create(T config); @Override ClusterManagementRealizationResult delete(
      T config); @Override ClusterManagementRealizationResult update(
      T config); @Override ClusterManagementListResult<T, R> list(
      T filter); @Override ClusterManagementGetResult<T, R> get(
      T config); @Override ClusterManagementOperationResult<A, V> start(
      A op); @Override ClusterManagementListOperationsResult<A, V> list(
      A opType); @Override ClusterManagementOperationResult<A, V> get(
      A opType, String opId); @Override CompletableFuture<ClusterManagementOperationResult<A, V>> getFuture(
      A opType, String opId); boolean isConnected(); @Override void close(); @VisibleForTesting
  // the dlock service name used by the CMS
  static final String CMS_DLOCK_SERVICE_NAME; }
@Test public void cleanResultsShouldCleanOutExceptionsAndNull() throws Exception { List functionResults = new ArrayList<>(); MemberInformation memberInfo = new MemberInformation(); memberInfo.setId("server-1"); functionResults.add(memberInfo); functionResults.add(new FunctionInvocationTargetException("Not available")); functionResults.add(null); List<MemberInformation> results = service.cleanResults(functionResults); assertThat(results).hasSize(1) .extracting(MemberInformation::getId) .containsExactly("server-1"); }