Questions tagged [stub]

A replacement implementation for objects, methods, or functions in order to remove external dependencies, or the object at the client end of an RPC or RMI invocation.

A replacement implementation for object, method, or function. The typical types of stubs are:

  • Testing stubs that remove external dependencies. They are typically used during unit and component testing. If you're trying to write a unit test and need to replace a simple call to a database, external libraries (e.g., file I/O) or other system API, stubbing might be perfectly suited for your needs.
  • RPC (CORBA, RMI, web service) stubs forward the call to remote service where it is handled; the answer, if any, is returned to the calling side. They implement the same interface that is implemented by the servicing object on remote side (may also implement additional interfaces).
  • Dummy stubs are empty placeholders for objects, methods or functions that are supposed to be completed later. They allow the current code to compile so that other, already finished parts could be tested. Such stubs are used when implementing a very large libraries following some already specified API.

A mock is somewhat similar to the testing stub but is not considered stub as it is a special purpose object capable of registering that has been called on it. It does not take other actions (a generally unfavoured partial mock does forwards execution of some methods to underlying object).

1108 questions
0
votes
3 answers

Faking web requests in Rails test without Fakeweb

I'm using the Handsoap gem with Httpclient gem as the driver in a Rails app. How can I prevent network calls from Handsaop/Httpclient gems in test cases? FakeWeb doesn't support Httpclient.
Steve McKinney
  • 3,183
  • 1
  • 23
  • 26
0
votes
1 answer

What is the bare minimum required in the EJB client classpath?

I write a remote EJB interface (3.0) and write the EJB implementation. Now I deploy the EJB as an ear on WAS. On a separate machine I write a Java client to call the EJB. In the classpath of the client, I just need to have the EJB stub? Is there…
Victor
  • 16,609
  • 71
  • 229
  • 409
0
votes
1 answer

Stubbing an exception, but evaluating normally (RSpec)

I'm trying to update an instance variable @status on an object based on the performance of a block. This block also makes calls to another class. def run @entries.keep_if { |i| valid_entry?(i) }.each do |e| begin unique_id = get_uniqueid…
Brad Rice
  • 1,334
  • 2
  • 17
  • 36
0
votes
1 answer

Can't connect to stub

I am struggling with the following error: 05.06.2013. 17:55:43 org.apache.myfaces.util.ExternalSpecifications isUnifiedELAvailable INFO: MyFaces Unified EL support enabled org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found at…
Danijel
  • 8,198
  • 18
  • 69
  • 133
0
votes
1 answer

JAX-WS: Eclipse Web Service wizard generates wrong stubs

I have a SOAP web service with JAX-WS. There I got a method createTransaction(String, String, String, int, String[][]). When I create a new Web Service client with Eclipse, it however generates stubs with the method createTransaction(String, int)…
Gob
  • 305
  • 2
  • 11
0
votes
1 answer

Use reflection stub to initialize a delegate field lazily

The problem: a .Net 2.0 class with a few thousand delegate fields generated by a code generator varying signatures delegates may or may not return values no generics these delegates much be initialized quickly at runtime initializing a delegate…
BlackStar
  • 213
  • 2
  • 7
0
votes
1 answer

why do we have to MANUALLY keep ; [semicolon] after ) [roundbracket] everytime after autostub

One stupid question is running on my mind. In Android, every time an OnClickListener or an event is generated i.e. an autostub is generated after the event, we have to manually keep the semicolon after the ). What is the reason behind that? Why is…
Shachi
  • 1,858
  • 3
  • 23
  • 41
0
votes
2 answers

Stubbing instance method for OpenTok object

The gem I'm using to integrate OpenTok in my Rails application is at: https://github.com/opentok/Opentok-Ruby-SDK. I based the core of the application on this example: http://www.tokbox.com/blog/building-a-video-party-app-with-ruby-on-rails. In the…
tanookiben
  • 22,575
  • 8
  • 27
  • 25
0
votes
2 answers

RSpec having trouble stubbing method called with inline rescue

I'm trying test a method on a controller: def a_method(list) @users = [] list.each do |x| if user=User.find(x) rescue nil @users << user end end end In my Rspec example I have : it "should do something" do User.stub :find =>…
telecasterrok
  • 209
  • 2
  • 12
0
votes
1 answer

Stubbing out save methodin rails with rspec

I have the following action in my controller: def create @user = current_user @vin = @user.vins.new(params[:vin]) if @vin.save # waiting for implementation logger.debug("here we are") else …
Agazoom
  • 618
  • 4
  • 19
0
votes
2 answers

Setting host address of rmi object

I want to set the host address of remote object in rmi. Is it possible setting this ip addres in stub ? NOT: I know that I can make a trick using ThreadLocalRmiClientSocket factory but I don't want to use it.
emin
  • 742
  • 9
  • 21
0
votes
1 answer

android webservice axis2 stub

im trying to learn about web services and i already did a simple webservice (sayhello) and made a client that show a console message. To do this... i made a webservice client that generate a stub. Now i need to consume this service from an android…
0
votes
1 answer

error opening port

My problem is that I have try and check with different port_name like 7 or 14 or 25. It's not opening or process the serial data the handle simply matching with the if condition and it is closing the handle. Is there any problem with the code? void…
0
votes
1 answer

How to test using interface collection with Rhino.Mocks

In my interface public IMyListInterface : IList { void Foo(); } how can I easily create an example for testing classes that use IMyListInterface. Currently I'm using GenerateStub() and delegating the needed methods /…
sixeyes
  • 483
  • 3
  • 14
0
votes
1 answer

Create an instance of an ASMX stub object from a real object

I have an ASMX web service that exposes several objects. I have a real instance of that object, and I would like to instantiate a stub object that is populated from it. Clearly there is such functionality already, because when the web service…
Jason Coyne
  • 6,509
  • 8
  • 40
  • 70