MemberInjectorLocator { @SuppressWarnings("unchecked") public static <T> MemberInjector<T> getMemberInjector(Class<T> clazz) { try { Class<? extends MemberInjector<T>> memberInjectorClass = (Class<? extends MemberInjector<T>>) Class.forName(clazz.getName() + "__MemberInjector"); return memberInjectorClass.newInstance(); } catch (Exception e) { return null; } } private  MemberInjectorLocator(); @SuppressWarnings("unchecked") static MemberInjector<T> getMemberInjector(Class<T> clazz);  }
@Test public void testGetMemberInjector_shouldFindTheMemberInjectorForFoo_whenTheMemberInjectorIsGenerated() { MemberInjector<Foo> memberInjector = MemberInjectorLocator.getMemberInjector(Foo.class); assertThat(memberInjector, notNullValue()); }
@Test public void testGetMemberInjector_shouldNotReturnNull_whenTheMemberInjectorIsNotGenerated() { MemberInjector<Qurtz> memberInjector = MemberInjectorLocator.getMemberInjector(Qurtz.class); assertThat(memberInjector, nullValue()); }