Commit Graph

220 Commits

Author SHA1 Message Date
Johnny Lim c154990024 Polish
Closes gh-5691
2016-04-15 08:35:25 +02:00
Phillip Webb 21bc166c95 Rename Import*AutoConfiguration classes
Rename Import*AutoConfiguration classes to AutoConfigure*.

Fixes gh-5692
2016-04-14 10:38:22 -07:00
Johnny Lim 90d897eb9d Polish
Closes gh-5685
2016-04-14 08:03:52 +02:00
Phillip Webb dbd577545d Remove trailing whitespace 2016-04-12 23:02:17 -07:00
Johnny Lim 10a73381e6 Remove a test doing nothing
Closes gh-5673
2016-04-12 22:47:08 -07:00
Phillip Webb b398b3319c Rename @SpringApplicationTest -> @SpringBootTest
Rename @SpringApplicationTest to SpringBootTest and
@SpringApplicationContextLoader to @SpringBootContextLoader.

Fixes gh-5562
2016-04-04 22:36:58 -07:00
Andy Wilkinson e41ccfae3c Correct javadoc tag 2016-04-04 17:47:05 +01:00
Andy Wilkinson eb3180d581 Provide test auto-configuration for Spring REST Docs
This commit introduces a new annotation, @AutoConfigureRestDocs,
which can be used to enable auto-configuration of Spring REST Docs.
The auto-configuration removes the need to use Spring REST Docs' JUnit
rule and will automatically configure MockMvc. Combined with the new
auto-configuration for MockMvc it allows a test class to be free of
boilerplate configuration:

@RunWith(SpringRunner.class)
@WebMvcTest
@AutoConfigureRestDocs(outputDir = "target/generated-snippets",
        uriScheme = "https", uriHost = "api.example.com",
        uriPort = 443)
public class ExampleDocumentationTests {

    @Autowired
    private MockMvc mvc;

    @Test
    public void documentIndex() {
        // …
    }

}

For more advanced customization a RestDocsMockMvcConfigurationCustomizer
bean can be used.

If a RestDocumentationResultHandler is found in the context, it will
be passed to the ConfigurableMockMvcBuilder's alwaysDo method as part
of its customization.

Closes gh-5563
2016-04-04 17:19:51 +01:00
Andy Wilkinson f99bfccd51 Polishing 2016-04-04 13:43:27 +01:00
Andy Wilkinson b630b080ce Make it easier to customize the auto-configured MockMvcBuilder
Closes gh-5556
2016-04-04 13:40:22 +01:00
Phillip Webb 893a6c32f3 Upgrade to checkstyle 6.17
Fixes gh-5547
2016-03-31 13:14:53 -07:00
Johnny Lim a28dd9d9e6 Polish
Closes gh-5532
2016-03-30 08:43:23 +02:00
Stephane Nicoll 6be92675c2 Remove dependency version from child pom 2016-03-24 14:53:20 +01:00
Phillip Webb 81d5635571 Add @DataJpaTest annotation
Add @DataJpaTest and @AutoConfigureTestDatabase annotations to allow
testing of an application "slice" that only deals JPA.

See gh-4901
2016-03-23 22:22:03 -07:00
Phillip Webb bbc91cc03f Add @WebMvcTest annotation
Add @WebMvcTest and @AutoConfigureMockMvc annotations to allow testing
of an application "slice" that only deals with Spring MVC.

See gh-4901
2016-03-23 22:21:59 -07:00
Phillip Webb 0bd89017b6 Add @JsonTest annotation
Add @JsonTest and @AutoConfigureJsonTesters annotations to allow testing
of an application "slice" that only deals with JSON marshalling.

See gh-4901
2016-03-23 22:21:29 -07:00
Phillip Webb 56fd4e1f76 Add TypeExcludeFilters support
Provide a way for auto-configuration tests to easily filter scanned
components.

See gh-4901
2016-03-23 22:21:23 -07:00
Phillip Webb 46099c753b Add @PropertyMapping support
Add @PropertyMapping annotation which can be used to mark annotation
attributes that should contribute Environment properties.

Provides a quick way for tests to change auto-configuration behavior in
a structured way.

Fixes gh-4901
2016-03-23 22:21:10 -07:00
Phillip Webb e5f224118b Print AutoConfigureReport on test failures
Add a TestExecutionListener to print the auto-configuration report
when a test cannot load.

See gh-4901
2016-03-23 22:21:04 -07:00
Phillip Webb 6d934bb270 Add spring-boot-test-autoconfigure module
Add a new test module to deal with auto-configuration in tests.

See gh-4901
2016-03-23 22:20:54 -07:00