Skip to content

Instantly share code, notes, and snippets.

@BenHall
Created December 24, 2009 22:35
Show Gist options
  • Save BenHall/263400 to your computer and use it in GitHub Desktop.
Save BenHall/263400 to your computer and use it in GitHub Desktop.
require 'java'
require 'out.jar'
include_class Java::ImplementingMockableClass
i = ImplementingMockableClass.new(v)
puts i.output_string
class ClassWithInterface
def get_string
"mocked"
end
end
i = ImplementingMockableClass.new(v)
puts i.output_string
class Faked
include Java::IInterface
def get_string
"Jruby Mocked"
end
end
i = ImplementingMockableClass.new(Faked.new)
puts i.output_string
ImplementingMockableClass - ClassWithInterface - GetString()
ImplementingMockableClass - ClassWithInterface - GetString()
ImplementingMockableClass - Jruby Mocked
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment