Commit f7ce70e94c33cef7384e394d206f9eafb4aa4652

Authored by Carlos Morais
Committed by Paulo Meireles
1 parent 65d89d1a

[Mezuro] StackTraceElementFixtures

plugins/mezuro/test/fixtures/stack_trace_element_fixtures.rb 0 → 100644
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
  1 +class StackTraceElementFixtures
  2 +
  3 + def self.create(method_name = 'my method name', line_number = 42)
  4 + element = Kalibro::Entities::StackTraceElement.new
  5 + element.declaring_class = 'my.declaring.Class'
  6 + element.method_name = method_name
  7 + element.file_name = 'MyFile.java'
  8 + element.line_number = line_number
  9 + element
  10 + end
  11 +
  12 + def self.create_hash(method_name = 'my method name', line_number = 42)
  13 + {:declaring_class => 'my.declaring.Class', :method_name => method_name, :file_name => 'MyFile.java',
  14 + :line_number => line_number}
  15 + end
  16 +
  17 +end
plugins/mezuro/test/unit/kalibro/entities/stack_trace_element_test.rb
1 require "test_helper" 1 require "test_helper"
2 -class StackTraceElementTest < ActiveSupport::TestCase  
3 2
4 - def self.fixture(method_name = 'stackTraceElementTestMethod', line_number = 42)  
5 - stack_trace_element = Kalibro::Entities::StackTraceElement.new  
6 - stack_trace_element.declaring_class = 'org.declaring.Class'  
7 - stack_trace_element.method_name = method_name  
8 - stack_trace_element.file_name = 'Class.java'  
9 - stack_trace_element.line_number = line_number  
10 - stack_trace_element  
11 - end 3 +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/stack_trace_element_fixtures"
12 4
13 - def self.fixture_hash(method_name = 'stackTraceElementTestMethod', line_number = 42)  
14 - {:declaring_class => 'org.declaring.Class',  
15 - :method_name => method_name,  
16 - :file_name => 'Class.java',  
17 - :line_number => line_number}  
18 - end 5 +class StackTraceElementTest < ActiveSupport::TestCase
19 6
20 def setup 7 def setup
21 - @hash = self.class.fixture_hash  
22 - @stack_trace_element = self.class.fixture 8 + @hash = StackTraceElementFixtures.create_hash
  9 + @stack_trace_element = StackTraceElementFixtures.create
23 end 10 end
24 11
25 should 'create stack trace element from hash' do 12 should 'create stack trace element from hash' do