I know if we use annotation @SpringBootTest
, we wire up whole application.
But if I need to run just this class without launching the whole app, how can I replace @SpringBootTest
?
I use @ContextConfiguration(classes = ClassThatYouAreGoingToTest.class)
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = ClassThatYouAreGoingToTest.class)
public class TestClass{
@MockBean
private BeanUsedInYourTestClass beanUsedInYourTestSubject;
.....///another mock bean if required
@Autowired
private ClassThayYouAreGoingToTest testSubject;
///your @Tests
}