### Question:
ClassPathSearch { public <T, R extends T> Class<R> findImplementation(Class<T> theInterface) { return findImplementation(theInterface, classes.size()); } ClassPathSearch(Class<?>... classesOfInterest); Class<R> findImplementation(Class<T> theInterface); @SuppressWarnings("unchecked") Class<R> findImplementation(Class<T> theInterface, int limit);  }### Answer:
@Test public void testFind() { assertSame(Hi.class, new ClassPathSearch().findImplementation(IHi.class)); }
@Test public void testFindWithSubInterfaces() { ClassPathSearch classPathSearch = new ClassPathSearch(); assertSame(Pla1.class, classPathSearch.findImplementation(IPla1.class)); assertSame(Pla2.class, classPathSearch.findImplementation(IPla2.class)); }
@Test public void testEarlyRemovalBug() { ClassPathSearch classPathSearch = new ClassPathSearch(IAA.class); assertSame(XPla3.class, classPathSearch.findImplementation(IPla4.class)); assertSame(XPla4.class, classPathSearch.findImplementation(IPla3.class)); }
@Test public void testFindWithAbstractClass() { ClassPathSearch classPathSearch = new ClassPathSearch(); assertSame(MulImpl.class, classPathSearch.findImplementation(IMul.class)); }
@Test public void testFailedSearch() { ClassPathSearch classPathSearch = new ClassPathSearch(); assertNull(classPathSearch.findImplementation(IFail.class, 200)); }