From f7ce70e94c33cef7384e394d206f9eafb4aa4652 Mon Sep 17 00:00:00 2001 From: Carlos Morais Date: Thu, 9 Feb 2012 18:46:57 -0200 Subject: [PATCH] [Mezuro] StackTraceElementFixtures --- plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb | 17 +++++++++++++++++ plugins/mezuro/test/unit/kalibro/entities/stack_trace_element_test.rb | 21 ++++----------------- 2 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb diff --git a/plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb b/plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb new file mode 100644 index 0000000..29f6bb4 --- /dev/null +++ b/plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb @@ -0,0 +1,17 @@ +class StackTraceElementFixtures + + def self.create(method_name = 'my method name', line_number = 42) + element = Kalibro::Entities::StackTraceElement.new + element.declaring_class = 'my.declaring.Class' + element.method_name = method_name + element.file_name = 'MyFile.java' + element.line_number = line_number + element + end + + def self.create_hash(method_name = 'my method name', line_number = 42) + {:declaring_class => 'my.declaring.Class', :method_name => method_name, :file_name => 'MyFile.java', + :line_number => line_number} + end + +end diff --git a/plugins/mezuro/test/unit/kalibro/entities/stack_trace_element_test.rb b/plugins/mezuro/test/unit/kalibro/entities/stack_trace_element_test.rb index 35235d3..dbf5f20 100644 --- a/plugins/mezuro/test/unit/kalibro/entities/stack_trace_element_test.rb +++ b/plugins/mezuro/test/unit/kalibro/entities/stack_trace_element_test.rb @@ -1,25 +1,12 @@ require "test_helper" -class StackTraceElementTest < ActiveSupport::TestCase - def self.fixture(method_name = 'stackTraceElementTestMethod', line_number = 42) - stack_trace_element = Kalibro::Entities::StackTraceElement.new - stack_trace_element.declaring_class = 'org.declaring.Class' - stack_trace_element.method_name = method_name - stack_trace_element.file_name = 'Class.java' - stack_trace_element.line_number = line_number - stack_trace_element - end +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/stack_trace_element_fixtures" - def self.fixture_hash(method_name = 'stackTraceElementTestMethod', line_number = 42) - {:declaring_class => 'org.declaring.Class', - :method_name => method_name, - :file_name => 'Class.java', - :line_number => line_number} - end +class StackTraceElementTest < ActiveSupport::TestCase def setup - @hash = self.class.fixture_hash - @stack_trace_element = self.class.fixture + @hash = StackTraceElementFixtures.create_hash + @stack_trace_element = StackTraceElementFixtures.create end should 'create stack trace element from hash' do -- libgit2 0.21.2