Skip to content

Commit

Permalink
Migrate test input from containsAllIn to its replacement, containsAtL…
Browse files Browse the repository at this point in the history
…eastElementsIn.

containsAllIn hasn't existed since 2019.

It's interesting that this test apparently still worked. Refaster must be faily permissive?

It's also interesting that this change... breaks the test? Maybe the workaround from CL 78788806 stopped working at some point, but it was after 2019, so we didn't notice?

(discovered during #2882 (comment))

PiperOrigin-RevId: 423797769
  • Loading branch information
cpovirk authored and Error Prone Team committed Jan 24, 2022
1 parent 2fc829e commit 072085f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
*/
public class WildcardUnificationTemplateExample {
public void example() {
// BUG: The template should remove the hasSize call below!
ImmutableList<String> actual = ImmutableList.of("kurt", "kluever");
ImmutableList<String> expected = ImmutableList.of("kluever", "kurt");
assertThat(actual).hasSize(expected.size());
assertThat(actual).containsAllIn(expected);
assertThat(actual).containsExactlyElementsIn(expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
*/
public class WildcardUnificationTemplateExample {
public void example() {
// BUG: The template should remove the hasSize call below!
ImmutableList<String> actual = ImmutableList.of("kurt", "kluever");
ImmutableList<String> expected = ImmutableList.of("kluever", "kurt");
assertThat(actual).hasSize(expected.size());
assertThat(actual).containsExactlyElementsIn(expected);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class WildcardUnificationTemplate {
@BeforeTemplate
static void containsAllOf(IterableSubject subject, Collection<?> expected) {
subject.hasSize(expected.size());
subject.containsAllIn(expected);
subject.containsAtLeastElementsIn(expected);
}

@AfterTemplate
Expand Down

0 comments on commit 072085f

Please sign in to comment.