HttpClient mockHttpClient = mock(HttpClient.class); when(mockHttpClient.executeMethod(any(GetMethod.class)).thenReturn(HttpStatus.SC_OK); MethodFactory factory = mock(MethodFactory.class); GetMethod get = mock(GetMethod.class); when(factory.createMethod()).thenReturn(get); when(get.getResponseBodyAsStream()).thenReturn(new FileInputStream(source));
public static final DynamicMethod createDynamicMethod(Ruby runtime, RubyModule module, com.kenai.jffi.Function function, Type returnType, Type[] parameterTypes, CallingConvention convention, IRubyObject enums, boolean ignoreErrno) { final MethodFactory[] factories = new MethodFactory[] { DefaultMethodFactory.getFactory() }; for (MethodFactory f : factories) { if (f.isSupported(returnType, parameterTypes, convention)) { return f.createMethod(module, function, returnType, parameterTypes, convention, enums, ignoreErrno); } } throw runtime.newRuntimeError("cannot create dynamic method"); }
public static final DynamicMethod createDynamicMethod(Ruby runtime, RubyModule module, com.kenai.jffi.Function function, Type returnType, Type[] parameterTypes, CallingConvention convention, IRubyObject enums, boolean ignoreErrno) { final MethodFactory[] factories = new MethodFactory[] { DefaultMethodFactory.getFactory() }; for (MethodFactory f : factories) { if (f.isSupported(returnType, parameterTypes, convention)) { return f.createMethod(module, function, returnType, parameterTypes, convention, enums, ignoreErrno); } } throw runtime.newRuntimeError("cannot create dynamic method"); }
public static final DynamicMethod createDynamicMethod(Ruby runtime, RubyModule module, com.kenai.jffi.Function function, Type returnType, Type[] parameterTypes, CallingConvention convention, IRubyObject enums, boolean ignoreErrno) { final MethodFactory[] factories = new MethodFactory[] { DefaultMethodFactory.getFactory() }; for (MethodFactory f : factories) { if (f.isSupported(returnType, parameterTypes, convention)) { return f.createMethod(module, function, returnType, parameterTypes, convention, enums, ignoreErrno); } } throw runtime.newRuntimeError("cannot create dynamic method"); }
public static final DynamicMethod createDynamicMethod(Ruby runtime, RubyModule module, com.kenai.jffi.Function function, Type returnType, Type[] parameterTypes, CallingConvention convention, IRubyObject enums, boolean ignoreErrno) { final MethodFactory[] factories = new MethodFactory[] { DefaultMethodFactory.getFactory() }; for (MethodFactory f : factories) { if (f.isSupported(returnType, parameterTypes, convention)) { return f.createMethod(module, function, returnType, parameterTypes, convention, enums, ignoreErrno); } } throw runtime.newRuntimeError("cannot create dynamic method"); }