cucumber.runtime.Utils Maven / Gradle / Ivy
package cucumber.runtime;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class Utils {
public static List listOf(int size, T obj) {
List list = new ArrayList();
for (int i = 0; i < size; i++) {
list.add(obj);
}
return list;
}
public static boolean isInstantiable(Class> clazz) {
boolean isNonStaticInnerClass = !Modifier.isStatic(clazz.getModifiers()) && clazz.getEnclosingClass() != null;
return Modifier.isPublic(clazz.getModifiers()) && !Modifier.isAbstract(clazz.getModifiers()) && !isNonStaticInnerClass;
}
public static Object invoke(final Object target, final Method method, long timeoutMillis, final Object... args) throws Throwable {
return Timeout.timeout(new Timeout.Callback
© 2015 - 2024 Weber Informatics LLC | Privacy Policy