Skip to content

Commit

Permalink
avoid File#listFiles in spec since it's ambiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Jul 15, 2015
1 parent c79610c commit 1d90f9f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.

This file was deleted.

@@ -0,0 +1,14 @@
package java_integration.fixtures.iface;

public interface SingleMethodInterfaceWithArg {
public static class Caller {
public static void call(SingleMethodInterfaceWithArg iface) {
call(42, iface);
}
public static <V> void call(V arg, SingleMethodInterfaceWithArg iface) {
iface.doSome(arg);
}
}

<V> void doSome(final V arg) ;
}
15 changes: 8 additions & 7 deletions spec/java_integration/interfaces/implementation_spec.rb
Expand Up @@ -190,15 +190,16 @@ def callIt
end

it "passes correct arguments to proc .impl" do
Java::java.io.File.new('.').listFiles do |pathname|
pathname.should be_kind_of(java.io.File)
true
Java::java.io.File.new('.').list do |dir, name| # FilenameFilter
dir.should be_kind_of(java.io.File)
name.should be_kind_of(String)
true # boolean accept(File dir, String name)
end

Java::java_integration.fixtures.iface.SingleMethodIfaceWith2Args::Caller.call do |arg1, arg2|
arg1.should == 'hello'
arg2.should == 42
end
caller = Java::java_integration.fixtures.iface.SingleMethodInterfaceWithArg::Caller

caller.call { |arg| arg.should == 42 }
caller.call('x') { |arg| arg.should == 'x' }
end

it "should maintain Ruby object equality when passed through Java and back" do
Expand Down

0 comments on commit 1d90f9f

Please sign in to comment.