Fix NoClassDefFoundError when Mockito is missing
Update MockReset class to check for the presence of the MockUtil class before attempting to use it. Fixes gh-7065
This commit is contained in:
committed by
Phillip Webb
parent
3326841a97
commit
16fe332f51
@@ -0,0 +1,32 @@
|
||||
package sample.testnomockito;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests that {code ResetMocksTestExecutionListener} and
|
||||
* {@code MockitoTestExecutionListener} gracefully degrade when Mockito is not on the
|
||||
* classpath.
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
public class SampleTestNoMockitoApplicationTest {
|
||||
|
||||
// gh-7065
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void contextLoads() throws Exception {
|
||||
assertThat(this.context).isNotNull();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user