Sha256: e2737c81cb4cd28c615bc88204c0bdc0f05809f5df6c1d010d44bae6b5f2bcdd
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
class AnnotationsTest < Test::Unit::TestCase def deprecated @deprecated ||= java.lang.Deprecated.java_class end def test_annotation_on_a_method cls, = compile(<<-EOF) $Deprecated def foo 'foo' end EOF assert_not_nil cls.java_class.java_method('foo').annotation(deprecated) assert_nil cls.java_class.annotation(deprecated) end def test_annotation_on_a_class cls, = compile(<<-EOF) $Deprecated class Annotated end EOF assert_not_nil cls.java_class.annotation(deprecated) end def test_annotation_on_a_field cls, = compile(<<-EOF) class AnnotatedField def initialize $Deprecated @foo = 1 end end EOF assert_not_nil cls.java_class.declared_fields[0].annotation(deprecated) end def test_annotation_with_an_integer cls, = compile(<<-EOF) import org.foo.IntAnno class IntValAnnotation $IntAnno[name: "bar", value: 1] def bar end end method = IntValAnnotation.class.getMethod("bar") anno = method.getAnnotation(IntAnno.class) puts anno.value EOF assert_output "1\n" do cls.main nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mirah-0.1.3-java | test/jvm/annotations_test.rb |