org.mockito.exceptions.misusing.NotAMockException: Argument should be a mock, but is: class com.sun.proxy.$Proxy36

petrikainulainen.net | 4 months ago
  1. 0

    Unit Testing of Spring MVC Controllers: REST API

    petrikainulainen.net | 6 months ago
    org.mockito.exceptions.misusing.NotAMockException: Argument should be a mock, but is: class com.sun.proxy.$Proxy36
  2. 0

    Unit Testing of Spring MVC Controllers: REST API

    petrikainulainen.net | 4 months ago
    org.mockito.exceptions.misusing.NotAMockException: Argument should be a mock, but is: class com.sun.proxy.$Proxy36
  3. 0

    Cannot instantiate mock objects using InjectMocks-Mockito

    Stack Overflow | 1 year ago | Bambi Yang
    org.mockito.exceptions.misusing.NotAMockException: Argument passed to verify() is of type Integer and is not a mock! Make sure you place the parenthesis correctly! See the examples of correct verifications: verify(mock).someMethod(); verify(mock, times(10)).someMethod(); verify(mock, atLeastOnce()).someMethod();
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Mockito: NotAMockException: Argument passed to verify() is of type MockHttpServletResponse and is not a mock

    Stack Overflow | 2 months ago | Amadeu Cabanilles
    org.mockito.exceptions.misusing.NotAMockException: Argument passed to verify() is of type MockHttpServletResponse and is not a mock! Make sure you place the parenthesis correctly! See the examples of correct verifications: verify(mock).someMethod(); verify(mock, times(10)).someMethod(); verify(mock, atLeastOnce()).someMethod();
  6. 0

    I get NotAMockException when trying to partially mock a void method - what am I doing wrong?

    Stack Overflow | 1 year ago | Kidburla
    org.mockito.exceptions.misusing.NotAMockException: Argument passed to when() is not a mock! Example of correct stubbing: doThrow(new RuntimeException()).when(mock).someMethod();

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.mockito.exceptions.misusing.NotAMockException

      Argument should be a mock, but is: class com.sun.proxy.$Proxy36

      at com.travenion.controllers.customer.CustomerControllerTest.setup()
    2. com.travenion.controllers
      CustomerControllerTest.setup
      1. com.travenion.controllers.customer.CustomerControllerTest.setup(CustomerControllerTest.java:50)
      1 frame