Sha256: e1d7f96be646a3aa0e8a344a686f73da3ac0c222f20161009e353e5824e5cb8a

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

# Copyright 2007 Jeff Mesnil (http://jmesnil.net)

require "test/unit"

require "jmx4r"
require "jconsole"

class TestAttribute < Test::Unit::TestCase
  import java.lang.management.ManagementFactory

  def setup
    @memory = JMX::MBean.find_by_name "java.lang:type=Memory", :connection => ManagementFactory.platform_mbean_server
  end

  def teardown
    JMX::MBean.remove_connection
  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
    @memory.verbose = false
  end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jmx4r-0.0.8 test/tc_attributes.rb