Class: JavaMethod::EasyMockStubMethodWriter
Instance Method Summary
collapse
#add_getter_stub_to, #add_stub_methods_to, #initialize, #underlying_method
Instance Method Details
#add_boolean_getter_stub_negative_case_to(body) ⇒ Object
360
361
362
|
# File 'lib/java_testing_guff/qdox_extensions.rb', line 360
def add_boolean_getter_stub_negative_case_to(body)
body.line("#{easyMock}.expect(mock.#{name}()).andStubReturn(false);")
end
|
#add_boolean_getter_stub_positive_case_to(body) ⇒ Object
356
357
358
|
# File 'lib/java_testing_guff/qdox_extensions.rb', line 356
def add_boolean_getter_stub_positive_case_to(body)
body.line("#{easyMock}.expect(mock.#{name}()).andStubReturn(true);")
end
|
#add_nonboolean_getter_stub_to(body, gotten_field_name) ⇒ Object
364
365
366
|
# File 'lib/java_testing_guff/qdox_extensions.rb', line 364
def add_nonboolean_getter_stub_to(body, gotten_field_name)
body.line("#{easyMock}.expect(mock.#{name}()).andStubReturn(#{gotten_field_name});")
end
|
#add_nongetter_stub_to(method_builder) ⇒ Object
368
369
370
371
372
373
374
375
376
377
378
379
|
# File 'lib/java_testing_guff/qdox_extensions.rb', line 368
def add_nongetter_stub_to(method_builder)
method_builder.body {|body|
if (returns_something?)
body.line("#{easyMock}.expect(mock.#{name}(#{parameter_list})).andStubReturn(result);")
else
body.line("mock.#{name}(#{parameter_list});")
body.line("#{easyMock}.expectLastCall().asStub();")
end
body.line('return (T) this;')
}
end
|
#append_throws_clause_if_necessary(generated_method) ⇒ Object
350
351
352
353
354
|
# File 'lib/java_testing_guff/qdox_extensions.rb', line 350
def append_throws_clause_if_necessary(generated_method)
with_exceptions do |e|
e.add_throws_clause_to(generated_method)
end
end
|