About 50 results
Open links in new tab
  1. unit testing - What is Mocking? - Stack Overflow

    Apr 19, 2010 · What is Mocking? . Mocking is primarily used in unit testing. An object under test may have dependencies on other (complex) objects. To isolate the behaviour of the object you want to …

  2. What's the difference between faking, mocking, and stubbing?

    Dec 6, 2008 · For example, mocking network requests allows you to test positive cases and fault cases without the unpredictable nature of actual network calls. Mocks will often include some metadata so …

  3. java - Mocking static methods with Mockito - Stack Overflow

    Mocking the static methods is considered to be a bad practice. If you try to do that, it means there is something wrong with the way you want to perform testing.

  4. Mocking member variables of a class using Mockito

    This is due to the way mocking is implemented in Mockito, where a subclass of the class to be mocked is created; only instances of this "mock" subclass can have mocked behavior, so you need to have …

  5. Simplify mocking dependencies with @InjectMocks - Stack Overflow

    Jun 12, 2025 · Simplify mocking dependencies with @InjectMocks Asked 9 months ago Modified 9 months ago Viewed 246 times

  6. python - Mocking a context manager - Stack Overflow

    You are setting the wrong mock: mock_tmp is not the context manager, but instead returns a context manager. Replace your setup line with:

  7. java - How to mock a final class with mockito - Stack Overflow

    Jan 12, 2013 · Mocking of final classes and methods is an incubating, opt-in feature. It uses a combination of Java agent instrumentation and subclassing in order to enable mockability of these …

  8. c# - Mocking EF DbContext with Moq - Stack Overflow

    I'm trying to create a unit test for my service with a mocked DbContext. I created an interface IDbContext with the following functions: public interface IDbContext : IDisposable { IDbSet<T...

  9. Use Mockito to mock some methods but not others

    Feb 20, 2013 · Partial mocking using Mockito's spy method could be the solution to your problem, as already stated in the answers above. To some degree I agree that, for your concrete use case, it …

  10. c# - Mocking HttpClient in unit tests - Stack Overflow

    Apr 5, 2016 · I have some issues trying to wrap my code to be used in unit tests. The issues is this. I have the interface IHttpHandler: public interface IHttpHandler { HttpClient client { get; } } And the ...