PrimeFactors { public static List<Integer> generate(int n) { if (n <= 1) { return Collections.emptyList(); } List<Integer> resultList = new ArrayList<>(); for (int index = 2; index <= n; index++) { if (isFactor(index, n) && isPrime(index)) { resultList.add(index); } } return resultList; }  static List<Integer> generate(int n);  }
@Test public void testNonPositive() { assertEquals(0, PrimeFactors.generate(-1).size()); assertEquals(0, PrimeFactors.generate(0).size()); }
@Test public void testOne() { assertEquals(0, PrimeFactors.generate(1).size()); }
@Test public void testTwo() { List<Integer> expectedList = generateList(2); assertEquals(expectedList, PrimeFactors.generate(2)); }
@Test public void testThree() { assertEquals(generateList(3), PrimeFactors.generate(3)); }
@Test public void testFour() { assertEquals(generateList(2), PrimeFactors.generate(4)); }
@Test public void testFive() { assertEquals(generateList(5), PrimeFactors.generate(5)); }
@Test public void testSix() { assertEquals(generateList(2,3), PrimeFactors.generate(6)); }
@Test public void test100() { assertEquals(generateList(2,5), PrimeFactors.generate(100)); }