字符串的AssertJ列表必须存在于预期中,忽略重复项
AssertJ List of String Must Exist In Expected, Ignoring Duplicates
我有一个预期的字符串列表:
List<String> expected = Arrays.asList("a", "b");
我希望用这些结果评估这些断言:
{"a", "a", "b", "b"} -> true
{"a", "b", "c"} -> false
本质上,我希望 assertJ ignore/remove 正在评估的任何重复项。如何使用断言 API 执行此操作?
尝试containsOnly
,引用 javadoc:
Verifies that the actual group contains only the given values and nothing else, in any order and ignoring duplicates (i.e. once a value is found, its duplicates are also considered found).
我有一个预期的字符串列表:
List<String> expected = Arrays.asList("a", "b");
我希望用这些结果评估这些断言:
{"a", "a", "b", "b"} -> true
{"a", "b", "c"} -> false
本质上,我希望 assertJ ignore/remove 正在评估的任何重复项。如何使用断言 API 执行此操作?
尝试containsOnly
,引用 javadoc:
Verifies that the actual group contains only the given values and nothing else, in any order and ignoring duplicates (i.e. once a value is found, its duplicates are also considered found).