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
-1
votes
1 answer

ClassNotFoundException: org.objectweb.jotm.SubCoordinator_Stub

I'm getting below JOTM exception in my application log. I didn't found any functionality that brakes due to this. I tried to figure out from where it is starting and end up finding 0 custom codes that start this error. Other than that I tried…
tk_
  • 16,415
  • 8
  • 80
  • 90
-1
votes
1 answer

WS02 generates POM but no source code

Having recently upgraded from WS02 3.1.0 to 5.2.1 I also upgraded the associated axis2 and rampart versions to 1.5 and 1.6.2 respectively. The WSo2 server runs up and creates my list of services and they are all present on the WSO2 console page. My…
Greg H
  • 1
  • 1
-1
votes
3 answers

Generate webservice stub from wsdl in Java

I am working on eclipse plugin which will have a wizard. This wizard will be available form example from context menu while mouse right click on Java editor. The wizard will be responsible for collecting such information as: location of WSDL…
MarcinK
  • 1
  • 1
  • 2
-1
votes
3 answers

Convert java version 1.8 to 1.7 compatible

Just to be clear I am not a java developer. I have java code written for version 1.8. However, the java.util.function is not available in version 1.7 hence I am not able to compile the code. How can I compile\convert the code to make it compatible…
Waseem Ahmed
  • 57
  • 10
-1
votes
1 answer

OCMock doesn't work properly in iOS?

I created the following class: @implementation BCGlobalConstantBox + (instancetype)sharedInstance { static BCGlobalConstantBox *instance = nil; static dispatch_once_t predicate; dispatch_once( &predicate, ^{ instance = [[self…
Gargo
  • 1,135
  • 1
  • 10
  • 21
-1
votes
1 answer

how to generate unique title like wordpress?

hye im maya, i need to generate unique title like wordpress. if title hello-world is exist,the next title will be hello-world-2 thanks
maya
  • 9
  • 1
-1
votes
1 answer

C program with a stub program

The question is : Create a C program with a stub program code to calculate taxes? void calculatetaxes (float gross, float deferred, float *fedtax,float *statetax,float *ssitax) ; //3.5 float calcfedtax(float gross, float deferred); //3.5.1…
-2
votes
1 answer

Test if method is being call on alien class

How can I test if MyModel.all is called ? The following code doesn't work as I expect it: class MyClass def call cached_records end private def cached_records Rails.cache.fetch(self.class.name.underscore) do MyModel.all …
-2
votes
1 answer

Is there something wrong with these unit tests?

I was reading an article by Martin Fowler (Mocks Aren't Stubs) and there's this Java test at the beginning: public class OrderStateTester extends TestCase { private static String TALISKER = "Talisker"; private static String HIGHLAND_PARK =…
lfk
  • 2,423
  • 6
  • 29
  • 46
-2
votes
2 answers

How do I stub IQueryable and IQueryable

How do I stub these methods: ProductDAL: public IQueryable getCatNameList() { var db = new Database(); var categoryNames = db.ProductCategories.Select(c => c.Name); return categoryNames; } public…
kuj asl
  • 23
  • 4
-2
votes
1 answer

Double an instance of a Ruby class

I am using Ruby on Rails with some hardware which is not available on my development machine. Using Rails.env I want to "double" an instance of a class so that the "real implementation" isn't called (~double class XY iff Rails.env == :production). I…
phikes
  • 565
  • 5
  • 13
-3
votes
1 answer

How to make stubs and spies on methods which import from a package?

I am a JavaScript and Python developer. Here is a unit testing code snippet using jestjs testing framework: index.ts: import dotenv from 'dotenv'; export class OsEnvFetcher { constructor() { const output = dotenv.config(); if…
Lin Du
  • 88,126
  • 95
  • 281
  • 483
-3
votes
1 answer

Decrypted exe wont run

I'm writing a c++ program that takes in input as an exe file, encrypts it (just xoring) and adds the encrypted exe as a resource to another exe (stub). The stub decrypts the exe and saves it. The problem is that the decrypted exe won't run. The…
Valentino
  • 59
  • 1
  • 11
1 2 3
73
74