often when i use powerMockito i wrtie this sentences
PowerMockito.doReturn(message).when(messageDAOMock.save(message));
i get unfinishedstubbingexception and i don't know why and hoy i can correct it. also i put
@RunWith(PowerMockRunner.class)
@PrepareForTest(MessageService.class)
public class MessageServiceTest{
@Spy
MessageService serviceToTest = new MessageService();
@Spy
IMessageDAO messageDAOMock = new MessageDAO();
and i am using this dependencies:
<dependencies>
<!-- https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4 -->
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.9</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.powermock/powermock-api-mockito2 -->
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.9</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/cglib/cglib -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.3.0</version>
</dependency>
and also i use junit 4.
tihs error sometimes it happens and sometimes it doesn't but i don't find out why or how i can solve it
thanks and sorry for my english, it is not my native languaje
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…