### Question:
InterfaceReport { public List<Throwable> getErrors() { final List<Throwable> retval = new ArrayList<Throwable>(); for (final TestInfo testInfo : contractTestMap.listTestInfo()) { retval.addAll( testInfo.getErrors() ); } return retval; } InterfaceReport(final String[] packages, ClassPathFilter filter, final ClassLoader classLoader); Collection<InterfaceInfo> getInterfaceInfoCollection(); Collection<Class<?>> getPackageClasses(); List<Throwable> getErrors(); Set<Class<?>> getUntestedInterfaces(); Set<Class<?>> getUnImplementedTests(); ClassPathFilter getClassFilter();  }### Answer:
@Test public void testGetErrors() { final String[] expectedErrors = { "java.lang.IllegalStateException: Classes annotated with @Contract (class org.xenei.junit.bad.BadNoInject) must include a @Contract.Inject annotation on a public non-abstract declared setter method", "java.lang.IllegalStateException: Classes annotated with @Contract (class org.xenei.junit.bad.BadAbstract) must not be abstract" }; interfaceReport = new InterfaceReport( packages, null, classLoader ); final List<String> errors = new ArrayList<String>(); for (final Throwable t : interfaceReport.getErrors()) { errors.add( t.toString() ); } for (final String expectedError : expectedErrors) { assertTrue( "missing: " + expectedError, errors.contains( expectedError ) ); } Assert.assertEquals( 2, errors.size() ); }
@Test public void testGetErrors_Filtered() { final String[] expectedErrors = { "java.lang.IllegalStateException: Classes annotated with @Contract (class org.xenei.junit.bad.BadNoInject) must include a @Contract.Inject annotation on a public non-abstract declared setter method", }; final ClassPathFilter filter = new NotClassFilter( new OrClassFilter( new NameClassFilter( "org.xenei.junit.contract.exampleTests.CImpl3" ), new NameClassFilter( "org.xenei.junit.contract.exampleTests.DTImplSuite$ForceA" ), new NameClassFilter( BadAbstract.class.getName() ) ) ); interfaceReport = new InterfaceReport( badPackages, filter, classLoader ); final List<String> errors = new ArrayList<String>(); for (final Throwable t : interfaceReport.getErrors()) { errors.add( t.toString() ); } for (final String expectedError : expectedErrors) { assertTrue( "missing: " + expectedError, errors.contains( expectedError ) ); } Assert.assertEquals( 2, errors.size() ); }