Springockito is a small extension to spring that simplifies way of creation mockito mocks in the intergation tests
Questions tagged [springockito]
12 questions
7
votes
2 answers
@ReplaceWithMock with @Qualifier
I am using springockito-annotations 1.0.9 for integration testing.
I have the following controller:
@Autowired
public Controller(
@Qualifier("passwordService ") PasswordService passwordService ,
@Qualifier("validator")…

fashuser
- 2,152
- 3
- 29
- 51
3
votes
3 answers
springockito xsd link is broken
The location of Springockito's mockito.xsd seems to be broken.
We used
xsi:schemaLocation="http://www.mockito.org/spring/mockito https://bitbucket.org/kubek2k/springockito/raw/tip/springockito/src/main/resources/spring/mockito.xsd
But this does not…

schoenk
- 824
- 3
- 13
- 31
3
votes
1 answer
Error while Mocking static function call
I am trying to Mock static but getting error message as below
org.mockito.exceptions.misusing.MissingMethodInvocationException:
when() requires an argument which has to be 'a method call on a mock'.
For example:
…

Sandeep
- 233
- 4
- 13
3
votes
2 answers
Mocked Objects in Context during tests execution
I'm working on an application which has both component and integration tests. The differences between then is: a component test test more than one class (i.e., its inner objects aren't all mocked out - but some of them might be [such as JMS…
user1348997
2
votes
1 answer
Why does spring try to inject dependencies into mocked object?
I am pretty new to Mockito and have a question.
I am using Spring's dependency injection for my app and try to test components. I have a test like this:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(// @formatter:off
loader =…

DAndy
- 117
- 11
1
vote
0 answers
What version of Mockito is springockito-annotations compatible with?
I'm using (or rather: tried using) Mockito 1.10.19 and springockito-annotatinos 1.0.9, but they don't agree with each other.
(I get a ClassNotFoundException: org.mockito.internal.MockitoInvocationHandler and have raised a bug with…

Christian
- 6,070
- 11
- 53
- 103
1
vote
1 answer
Mockito spies - verify() calls the method instead of checking
I'm trying to use Springockito and spies to verify that calls were made/not made on a service method during an end-to-end test. I'm autowiring the service that the process will also get, and spy on it. Although myService instance is instrumented,…

Laszlo B
- 455
- 3
- 14
1
vote
1 answer
How to inject mock bean in SpringConfiguration to create another bean.?
I have problem with unit test. Below is the sample code snippet. I have mock a bean and inject into @configuration class and use the mocked property to create another bean.
In the below, if i inspect, b.getSomething() returning me the default value…

Manoj
- 5,707
- 19
- 56
- 86
1
vote
1 answer
mock test failing while doing mvn install
I have below test which works successfully while executing in IDE but when I do mvn install it fails with below msg
org.mockito.exceptions.misusing.MissingMethodInvocationException:
when() requires an argument which has to be 'a method call on a…

Rips
- 1,964
- 1
- 23
- 45
0
votes
1 answer
Trying to define a Mockito-stub executes the mocked method. Why?
We are trying to define a UnitTest where we mock an object which I here called x for simplicity:
...
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import…

mmo
- 3,897
- 11
- 42
- 63
0
votes
1 answer
Java Spring: Mocking Context in Multiple Files
Trying to make mocked Spring Context for unit tests purpose. Our Spring Configuration is pretty big and as for now trying to get this thing using Spring + Springockito Annotations.
Problem that I've stumbled upon is that I'd like to have multiple…

GoMati
- 67
- 2
- 12
0
votes
2 answers
@ContextConfiguration is not inherited with Springockito
I am currently playing around with springockito-annotations and this requires @RunWith and @ContextConfiguration annotations in order to work. I would like to put these annotations on a superclass of my tests, but can't seem to get it to…

Tobb
- 11,850
- 6
- 52
- 77