#190 - More simplifications for Spring Boot 1.4 M3.

Replaced all occurrences of @SpringApplicationConfiguration with @SpringBootTest. Using SpringRunner instead of @SpringJUnit4ClassRunner now.
This commit is contained in:
Oliver Gierke
2016-06-11 11:26:23 +02:00
parent 24ca298de2
commit 6684c8c69b
86 changed files with 411 additions and 640 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,15 +18,11 @@ package example.springdata.rest.headers;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import example.springdata.rest.headers.Application;
import example.springdata.rest.headers.Customer;
import example.springdata.rest.headers.CustomerRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* Integration tests to bootstrap the application.
@@ -34,8 +30,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* @author Oliver Gierke
* @soundtrack The Intersphere - Out of phase (Live at Alte Feuerwache Mannheim)
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationIntegrationTests {
@Autowired CustomerRepository repository;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,21 +21,16 @@ import static org.springframework.restdocs.RestDocumentation.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import example.springdata.rest.headers.Application;
import example.springdata.rest.headers.Customer;
import example.springdata.rest.headers.CustomerRepository;
import java.net.URI;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.restdocs.config.RestDocumentationConfigurer;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@@ -45,9 +40,8 @@ import org.springframework.web.util.UriTemplate;
* @author Oliver Gierke
* @soundtrack The Intersphere - Out of phase (Live at Alte Feuerwache Mannheim)
*/
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@SpringApplicationConfiguration(classes = Application.class)
@RunWith(SpringRunner.class)
@SpringBootTest
public class WebIntegrationTests {
@Autowired WebApplicationContext context;