Sha256: 920281fcb12e54df8c8ded7818103df53e8799fc6ca5de45239527d2fe42a76a

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

require 'test/unit'
require 'rubygems'
require 'rubeus'
# Rubeus.verbose = true

# Test for extensions.rb
class TestExtensions < Test::Unit::TestCase
	# setup method
	def setup
	end

	# test path_for
	def test_path_for
		# java fqn
		assert_equal("rubeus/extensions/javax/swing/j_table", Rubeus::Extensions.path_for("javax.swing.JTable"))
		assert_equal("rubeus/extensions/javax/swing/j_tabbed_pane", Rubeus::Extensions.path_for("javax.swing.JTabbedPane"))

		# parts
		assert_equal("rubeus/extensions/javax/swing/j_table", Rubeus::Extensions.path_for(["javax", "swing", "JTable"]))
		assert_equal("rubeus/extensions/javax/swing/j_tabbed_pane", Rubeus::Extensions.path_for(["javax", "swing", "JTabbedPane"]))
	end

	# test class_name_for
	def test_class_name_for
		# java fqn
		assert_equal("Rubeus::Extensions::Javax::Swing::JTable", Rubeus::Extensions.class_name_for("javax.swing.JTable"))
		assert_equal("Rubeus::Extensions::Javax::Swing::JTabbedPane", Rubeus::Extensions.class_name_for("javax.swing.JTabbedPane"))

		# parts
		assert_equal("Rubeus::Extensions::Javax::Swing::JTable", Rubeus::Extensions.class_name_for(["javax", "swing", "JTable"]))
		assert_equal("Rubeus::Extensions::Javax::Swing::JTabbedPane", Rubeus::Extensions.class_name_for(["javax", "swing", "JTabbedPane"]))
	end

	# test find_for
	def test_find_for
		# normal
		assert_nothing_raised do
			Rubeus::Extensions.find_for("javax.swing.JTable")
		end

		# LoadError
		assert_nil(Rubeus::Extensions.find_for("javax.swing.DoesNotExistClass"))
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubeus-0.0.8-java test/rubeus/test_extensions.rb
rubeus-0.0.7-java test/rubeus/test_extensions.rb