private final Class<?> implementerClass;
private final long timeoutInMilliseconds;
private Class<?> getImplementer(Class<?> interfaceType) {
if (!interfaceType.isInterface()){
throw new NotImplementedException(interfaceType.getSimpleName() +
" is not an interface");
}
ImplementedBy implBy = interfaceType.getAnnotation(ImplementedBy.class);
if (implBy == null){
throw new NotImplementedException(interfaceType.getSimpleName() +
" is not implemented by any class (or not annotated by @ImplementedBy)");
}
Class<?> implementerClass = implBy.value();
if (!interfaceType.isAssignableFrom(implementerClass)) {
throw new NotImplementedException("implementer Class does not implement the interface " + interfaceType.getName());
}
return implementerClass;
}