public Set<String> excludedTopics(ClusterModel clusterModel, Pattern requestedExcludedTopics) {
    Pattern topicsToExclude = requestedExcludedTopics != null ? requestedExcludedTopics : _defaultExcludedTopics;
    return Utils.getTopicNamesMatchedWithPattern(topicsToExclude, clusterModel::topics);
  }
@Test
  public void testGetExcludedTopics() {
    // 4 topics in total and 2 of them are excluded
    String excludedTopicPrefix = "excluded_topic_";
    String notExcludedTopicPrefix = "not_excluded_topic_";
    Set<String> expectedExcludedTopics = Set.of(excludedTopicPrefix + 1, excludedTopicPrefix + 2);
    Set<String> allTopics = new HashSet<>();
    allTopics.addAll(expectedExcludedTopics);
    allTopics.add(notExcludedTopicPrefix + 1);
    allTopics.add(notExcludedTopicPrefix + 2);
    allTopics = Collections.unmodifiableSet(allTopics);
    String topicExcludedFromPartitionMovementPattern = excludedTopicPrefix + ".*";

    // Verify case 1: use default topic name pattern from config
    Properties properties = new Properties();
    properties.put(AnalyzerConfig.TOPICS_EXCLUDED_FROM_PARTITION_MOVEMENT_CONFIG, topicExcludedFromPartitionMovementPattern);
    GoalOptimizer goalOptimizer = createGoalOptimizer(properties);
    ClusterModel clusterModel = EasyMock.mock(ClusterModel.class);
    EasyMock.expect(clusterModel.topics()).andReturn(allTopics).once();
    EasyMock.replay(clusterModel);
    Set<String> excludedTopics = goalOptimizer.excludedTopics(clusterModel, null);

    Assert.assertEquals(expectedExcludedTopics, excludedTopics);
    EasyMock.verify(clusterModel);
    EasyMock.reset(clusterModel);

    // Verify case 2: use topic name pattern passed as argument
    EasyMock.expect(clusterModel.topics()).andReturn(allTopics).once();
    EasyMock.replay(clusterModel);
    goalOptimizer = createGoalOptimizer();
    excludedTopics = goalOptimizer.excludedTopics(clusterModel, Pattern.compile(topicExcludedFromPartitionMovementPattern));
    Assert.assertEquals(expectedExcludedTopics, excludedTopics);
    EasyMock.verify(clusterModel);
  }