Skip to content

Commit fd6c6fa

Browse files
eamonnmcmanuscushon
authored andcommitted
Adjust AutoValueTest so that it covers setting an immutable collection of T from a Collection<? extends T>. The actual bug was fixed long ago but never closed and never covered by an explicit test.
RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=201956399
1 parent 1a6c9fe commit fd6c6fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

value/src/it/functional/src/test/java/com/google/auto/value/AutoValueTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,13 +2189,13 @@ public void testBuilderWithExoticPropertyBuilders() {
21892189
public abstract static class BuilderWithCopyingSetters<T extends Number> {
21902190
public abstract ImmutableSet<? extends T> things();
21912191

2192-
public abstract ImmutableList<String> strings();
2192+
public abstract ImmutableList<Number> numbers();
21932193

21942194
public abstract ImmutableMap<String, T> map();
21952195

21962196
public static <T extends Number> Builder<T> builder(T value) {
21972197
return new AutoValue_AutoValueTest_BuilderWithCopyingSetters.Builder<T>()
2198-
.setStrings(ImmutableSet.of("foo", "bar"))
2198+
.setNumbers(ImmutableSet.of(17, 23.0))
21992199
.setMap(Collections.singletonMap("foo", value));
22002200
}
22012201

@@ -2207,7 +2207,7 @@ public interface Builder<T extends Number> {
22072207

22082208
Builder<T> setThings(T... things);
22092209

2210-
Builder<T> setStrings(Collection<String> strings);
2210+
Builder<T> setNumbers(Collection<? extends Number> strings);
22112211

22122212
Builder<T> setMap(Map<String, T> map);
22132213

@@ -2221,7 +2221,7 @@ public void testBuilderWithCopyingSetters() {
22212221

22222222
BuilderWithCopyingSetters<Integer> a = builder.setThings(ImmutableSet.of(1, 2)).build();
22232223
assertEquals(ImmutableSet.of(1, 2), a.things());
2224-
assertEquals(ImmutableList.of("foo", "bar"), a.strings());
2224+
assertEquals(ImmutableList.of(17, 23.0), a.numbers());
22252225
assertEquals(ImmutableMap.of("foo", 23), a.map());
22262226

22272227
BuilderWithCopyingSetters<Integer> b = builder.setThings(Arrays.asList(1, 2)).build();

0 commit comments

Comments
 (0)