diff --git a/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java b/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java index 4f0ba466ea..8143da5794 100644 --- a/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java +++ b/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java @@ -9,10 +9,9 @@ import java.util.Random; public class RandomListElementTest { @Test - public void givenList_shouldReturnARandomElement1() throws Exception { + public void givenList_whenRandomNumberChosen_shouldReturnARandomElement() { List givenList = Arrays.asList(1, 2, 3); Random rand = new Random(); - - Integer result = givenList.get(rand.nextInt(givenList.size())); + givenList.get(rand.nextInt(givenList.size())); } }