@Test public void list_of_multiple_elements_returns_one() { Object element1 = new Object(); Object element2 = new Object(); Object element3 = new Object(); this.list.add(element1); this.list.add(element2); this.list.add(element3); for(int i = 0; i < 100; i++) { Object element = this.strategy.get(this.list); assertTrue(this.list.contains(element)); } }
@Override public <T> T get(List<T> list) { int index = random.nextInt(list.size()); return list.get(index); }
RandomElementStrategy implements ElementFromListStrategy { @Override public <T> T get(List<T> list) { int index = random.nextInt(list.size()); return list.get(index); } }
RandomElementStrategy implements ElementFromListStrategy { @Override public <T> T get(List<T> list) { int index = random.nextInt(list.size()); return list.get(index); }  }
RandomElementStrategy implements ElementFromListStrategy { @Override public <T> T get(List<T> list) { int index = random.nextInt(list.size()); return list.get(index); }  @Override T get(List<T> list); }
RandomElementStrategy implements ElementFromListStrategy { @Override public <T> T get(List<T> list) { int index = random.nextInt(list.size()); return list.get(index); }  @Override T get(List<T> list);  }