BAEL-297 - passed list as a constructor creation. Array.aslist returns a fixed lenght list and throws exception on remove

This commit is contained in:
slavisa-baeldung 2016-10-05 07:34:29 +02:00
parent ea39b9cacf
commit 05c6859412
1 changed files with 2 additions and 5 deletions

View File

@ -2,10 +2,7 @@ package com.baeldung;
import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class RandomListElementTest {
@ -41,7 +38,7 @@ public class RandomListElementTest {
@Test
public void givenList_whenNumberElementsChosen_shouldReturnRandomElementsNoRepeat() {
Random rand = new Random();
List<String> givenList = Arrays.asList("one", "two", "three", "four");
List<String> givenList = new LinkedList<>(Arrays.asList("one", "two", "three", "four"));
int numberOfElements = 2;