### Question:
PrimeGenerator { public static List<Integer> primeNumbersTill(int max) { return IntStream.rangeClosed(2, max) .filter(x -> isPrime(x)) .boxed() .collect(Collectors.toList()); }  static List<Integer> sieveOfEratosthenes(int n); static List<Integer> primeNumbersBruteForce(int max); static List<Integer> primeNumbersTill(int max);  }### Answer:
@Test public void whenOptimized_returnsSuccessfully() { final List<Integer> primeNumbers = primeNumbersTill(20); assertEquals(Arrays.asList(new Integer[] { 2, 3, 5, 7, 11, 13, 17, 19 }), primeNumbers); }