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 mock'.
Below is the test class:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = SpringockitoContextLoader.class,locations={"classpath:conf/test-context.xml"})
public class ServiceTest
{
@ReplaceWithMock
@Autowired
private Object1 object1
@Autowired
private Service service;
@Before
public void setup()
{
MockitoAnnotations.initMocks(this);
}
@Test
public void test()
{//below line is failing while doing mvn install
Mockito.when(object1.validate(String validateMe)).thenReturn(true)
}
}
Do I need any other extra configuration to have it work in maven ?
Aucun commentaire:
Enregistrer un commentaire