Sha256: 0dca74e561221bc8033e130eebfc8696030ff91f287ce4bdd88253cf56c36373

Contents?: true

Size: 785 Bytes

Versions: 2

Compression:

Stored size: 785 Bytes

Contents

require "test/unit"

require "jmx4r"
require "jconsole"

class TestAttribute < Test::Unit::TestCase
    def setup
        JConsole::start
        @memory = JMX::MBean.find_by_name "java.lang:type=Memory"
    end

    def teardown
        JMX::MBean.remove_connection
        JConsole::stop
    end

    def test_unknwown_attribute
        assert_raise(NoMethodError) { @memory.unknown_attribute }
    end

    def test_readable_attribute
        assert_equal false, @memory.verbose
    end

    def test_writable_attribute
        assert_equal false, @memory.verbose
        @memory.verbose = true
        assert_equal true, @memory.verbose
    end

    def test_non_writable_attribute
        assert_raise(NoMethodError) { @memory.object_pending_finalization_count = -1 }
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jmx4r-0.0.1 test/tc_attributes.rb
jmx4r-0.0.2 test/tc_attributes.rb