title: SpringRunner unable to detect configuration
body: <p>I have a spring-boot application for which am trying to create unit testcases. Below is the code that I am trying to run, I don't have any configuration file that I have (used only annotations) so the main class that loads all the configuration is <code>ElastSearchBootApplication</code> class. For some reason I see the below error.</p>
  
  <pre><code>@ComponentScan(basePackages = "com.somename")
  @SpringBootApplication
  @EnableScheduling
  public class ElastSearchBootApplication {
  
      private static final Logger LOG = LoggerFactory.getLogger(ElastSearchBootApplication.class);
  
      public static void main(String[] args) {
          SpringApplication.run(ElastSearchBootApplication.class, args);
      }
  
      @Autowired
      private ElastSearchLogLevel logsSearch;
  
      @Scheduled(fixedRate = 120000)
  public void scheduledSearchLogs() {
          ...
  </code></pre>
  
  <p>Test class :</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = ElastSearchBootApplication.class)
  public class LogSearchTest {
  
      @Mock
      private RestHighLevelClient client;
      @Mock
        private ExecutorService ALERT_POOL;
  
      @Before
      public void setUp() throws Exception {
            client = mock(RestHighLevelClient.class);
          ALERT_POOL = mock(ExecutorService.class);
  
          try {
              when(client.search(anyObject())).thenReturn(getResponse());
          } catch (Exception e) {
              // I see NullPointerException but both the instances are available here
              e.printStackTrace();
          }
          doNothing().when(ALERT_POOL.invokeAll(anyObject()));
      }
  </code></pre>
  
  <p>I see the below error when trying to run the spring-boot test :</p>
  
  <pre><code>org.springframework.boot.test.context.SpringBootTestContextBootstrapper buildDefaultMergedContextConfiguration
  INFO: Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.somename.search.LogSearchTest], using SpringBootContextLoader
  org.springframework.test.context.support.AbstractContextLoader generateDefaultLocations
  INFO: Could not detect default resource locations for test class [com.somename.search.LogSearchTest]: no resource found for suffixes {-context.xml, Context.groovy}.
  org.springframework.test.context.support.AnnotationConfigContextLoaderUtils detectDefaultConfigurationClasses
  INFO: Could not detect default configuration classes for test class [com.somename.search.LogSearchTest]: LogSearchTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
  </code></pre>
  
  <ol>
  <li><p>I see that <code>@SpringBootTest</code> is used for integration tests, so can I use it for unit tests ? If I remove it then I get another set of exception that looks similar though. I would be more interested in running this testcase without <code>SpringBootTest</code></p></li>
  <li><p>Why my test case say some configuration is missing. The samples online talk about xml files which I don't have. So what am I missing here ?</p></li>
  <li><p>Can I dynamically pass the value for <code>fixedRate</code> from <code>Environment</code> and put it like <code>@Scheduled(fixedRate = ${some.value.defined})</code></p></li>
  </ol>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I can run the test but without the proper order. Ideally i expect <code>setUp</code> to run first. But its running second. Also the line <code>when(client.search(anyObject())).thenReturn(getResponse());</code> is failing and i dont get the reason...</p>