def METHOD_NAME(
    rule_runner: RuleRunner,
    expected: set[str],
    *,
    target_type: list[str] | None = None,
    address_regex: list[str] | None = None,
    tag_regex: list[str] | None = None,
    granularity: TargetGranularity = TargetGranularity.all_targets,
) -> None:
    filter_result = rule_runner.run_goal_rule(
        FilterGoal,
        args=[
            f"--target-type={target_type or []}",
            f"--address-regex={address_regex or []}",
            f"--tag-regex={tag_regex or []}",
            f"--granularity={granularity.value}",
            "::",
        ],
    )
    assert set(filter_result.stdout.splitlines()) == expected
    list_result = rule_runner.run_goal_rule(
        List,
        global_args=[
            f"--filter-target-type={target_type or []}",
            f"--filter-address-regex={address_regex or []}",
            f"--filter-tag-regex={tag_regex or []}",
            f"--filter-granularity={granularity.value}",
            "::",
        ],
    )
    assert set(list_result.stdout.splitlines()) == expected