Top "Mocking" questions

Mocking and faking are ways to isolate code or components to ensure that unit tests run against the testable unit of code only without actually utilizing other components or dependencies of an application.

EasyMock: Void Methods

I have a method that returns void in a class that is a dependency of the class I want to …

java unit-testing mocking void easymock
What's the best strategy for unit-testing database-driven applications?

I work with a lot of web applications that are driven by databases of varying complexity on the backend. Typically, …

database unit-testing orm mocking
Injecting a mock into an AngularJS service

I have an AngularJS service written and I would like to unit test it. angular.module('myServiceProvider', ['fooServiceProvider', 'barServiceProvider']). factory(…

javascript angularjs mocking jasmine angularjs-service
How do I mock a class without an interface?

I am working on .NET 4.0 using C# in Windows 7. I want to test the communication between some methods using mock. …

c# mocking tdd
Assert a function/method was not called using Mock

I'm using the Mock library to test my application, but I want to assert that some function was not called. …

python unit-testing mocking python-mock
Mocking Java InputStream

Please provide pointers to help me mock that java InputStream object. This is the line of code that I would …

java mocking
mocking window.location.href in Javascript

I have some unit tests for a function that makes use of the window.location.href -- not ideal I …

javascript mocking jasmine
phpunit mock method multiple calls with different arguments

Is there any way to define different mock-expects for different input arguments? For example, I have database layer class called …

php mocking phpunit
Using Moq to determine if a method is called

It is my understanding that I can test that a method call will occur if I call a higher level …

c# .net unit-testing mocking moq
How to mock the Request on Controller in ASP.Net MVC?

I have a controller in C# using the ASP.Net MVC framework public class HomeController:Controller{ public ActionResult Index() { if (…

asp.net-mvc unit-testing mocking rhino-mocks moq