Skip to content

Commit

Permalink
Avoid using collection as bean type in ManagedBeanTypesTest
Browse files Browse the repository at this point in the history
  • Loading branch information
manovotn committed Sep 21, 2023
1 parent 899d79e commit 4089e59
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,119 +25,10 @@
import java.util.ListIterator;

@Dependent
public class Flock implements List<Vulture<Integer>> {
public class Flock implements Gathering<Vulture<Integer>> {

@Override
public int size() {
return 0;
}

@Override
public boolean isEmpty() {
return false;
}

@Override
public boolean contains(Object o) {
return false;
}

@Override
public Iterator<Vulture<Integer>> iterator() {
public Vulture<Integer> getType() {
return null;
}

@Override
public Object[] toArray() {
return null;
}

@Override
public <T> T[] toArray(T[] a) {
return null;
}

@Override
public boolean add(Vulture<Integer> e) {
return false;
}

@Override
public boolean remove(Object o) {
return false;
}

@Override
public boolean containsAll(Collection<?> c) {
return false;
}

@Override
public boolean addAll(Collection<? extends Vulture<Integer>> c) {
return false;
}

@Override
public boolean addAll(int index, Collection<? extends Vulture<Integer>> c) {
return false;
}

@Override
public boolean removeAll(Collection<?> c) {
return false;
}

@Override
public boolean retainAll(Collection<?> c) {
return false;
}

@Override
public void clear() {
}

@Override
public Vulture<Integer> get(int index) {
return null;
}

@Override
public Vulture<Integer> set(int index, Vulture<Integer> element) {
return null;
}

@Override
public void add(int index, Vulture<Integer> element) {
}

@Override
public Vulture<Integer> remove(int index) {
return null;
}

@Override
public int indexOf(Object o) {
return 0;
}

@Override
public int lastIndexOf(Object o) {
return 0;
}

@Override
public ListIterator<Vulture<Integer>> listIterator() {
return null;
}

@Override
public ListIterator<Vulture<Integer>> listIterator(int index) {
return null;
}

@Override
public List<Vulture<Integer>> subList(int fromIndex, int toIndex) {
return null;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.jboss.cdi.tck.tests.definition.bean.types;

public interface Gathering<T> extends GroupingOfCertainType<T> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.jboss.cdi.tck.tests.definition.bean.types;

public interface GroupingOfCertainType<T> {

T getType(); // just to avoid having <T> unused
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ public void testGenericHierarchyBeanTypes() {
// Nested generic class inheritance
Bean<Flock> flockBean = getUniqueBean(Flock.class);
assertNotNull(flockBean);
// Object, Flock, List<Vulture<Integer>>, Collection<Vulture<Integer>>, Iterable<Vulture<Integer>>
assertTypeSetMatches(flockBean.getTypes(), Object.class, Flock.class, new TypeLiteral<List<Vulture<Integer>>>() {
}.getType(), new TypeLiteral<Collection<Vulture<Integer>>>() {
}.getType(), new TypeLiteral<Iterable<Vulture<Integer>>>() {
// Object, Flock, Gathering<Vulture<Integer>>, GroupingOfCertainType<Vulture<Integer>>
assertTypeSetMatches(flockBean.getTypes(), Object.class, Flock.class, new TypeLiteral<Gathering<Vulture<Integer>>>() {
}.getType(), new TypeLiteral<GroupingOfCertainType<Vulture<Integer>>>() {
}.getType());
}

Expand Down

0 comments on commit 4089e59

Please sign in to comment.