I cannot use the feature with OutputCapture
within JUnit testing. I want to use this feature to see some log messages.
If I tried to include the class package org.springframework.book.test.rule.OutputCapture
in IDEA it shows me warn message "No suggestions". So that I am not able to access to outputCapture class (even test package is not visible).
As I found out on this website this class is supported since version 1.3. However I am using correct spring boot version 1.5.
import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.test.rule.OutputCapture; THIS IS NOT RECOGNIZED
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
public class MyTest {
@Rule
public OutputCapture capture = new OutputCapture();
@Test
public void testName() throws Exception {
System.out.println("Hello World!");
assertThat(capture.toString(), containsString("World"));
}
}
What is wrong?