Method: JavaMethod#add_expectation_methods_to

Defined in:
lib/java_testing_guff/qdox_extensions.rb

#add_expectation_methods_to(generated_class) ⇒ Object



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/java_testing_guff/qdox_extensions.rb', line 252

def add_expectation_methods_to(generated_class)
    if (!getter?)
        method_builder = generated_class.add_method("expecting#{name.camelize}").returns('T')
        with_parameters_and_return do |p|
            p.add_takes_clause_to(method_builder)
        end

        with_exceptions do |e|
            e.add_throws_clause_to(method_builder)
        end

        method_builder.body {|body|
            yield body
            body.line('return (T) this;')
        }
    end

end