### Question:
PublicClassValidator implements TestClassValidator { public List<Exception> validateTestClass(TestClass testClass) { if (testClass.isPublic()) { return NO_VALIDATION_ERRORS; } else { return singletonList(new Exception("The class " + testClass.getName() + " is not public.")); } }  List<Exception> validateTestClass(TestClass testClass);  }### Answer:
@Test public void acceptsPublicClass() { TestClass testClass = new TestClass(PublicClass.class); List<Exception> validationErrors = validator .validateTestClass(testClass); assertThat(validationErrors, is(equalTo(Collections.<Exception> emptyList()))); }
@Test public void rejectsNonPublicClass() { TestClass testClass = new TestClass(NonPublicClass.class); List<Exception> validationErrors = validator .validateTestClass(testClass); assertThat("Wrong number of errors.", validationErrors.size(), is(equalTo(1))); }