### Question:
PrimeGenerator { public static List<Integer> sieveOfEratosthenes(int n) { final boolean prime[] = new boolean[n + 1]; Arrays.fill(prime, true); for (int p = 2; p * p <= n; p++) { if (prime[p]) { for (int i = p * 2; i <= n; i += p) prime[i] = false; } } final List<Integer> primes = new LinkedList<>(); for (int i = 2; i <= n; i++) { if (prime[i]) primes.add(i); } return primes; }  static List<Integer> sieveOfEratosthenes(int n); static List<Integer> primeNumbersBruteForce(int max); static List<Integer> primeNumbersTill(int max);  }### Answer:
@Test public void whenSieveOfEratosthenes_returnsSuccessfully() { final List<Integer> primeNumbers = sieveOfEratosthenes(20); assertEquals(Arrays.asList(new Integer[] { 2, 3, 5, 7, 11, 13, 17, 19 }), primeNumbers); }