Commit Graph

274 Commits (222ed44bd4824a0b8020fcbc7e5b0429a6cf7a95)

Author SHA1 Message Date
Andy Wilkinson 34b6915607 Consider meta-annotations when creating an AnnotationsPropertySource
Previously, meta-annotations were not considered when looking for
annotations that may have property mappings but were considered when
looking for a `@PropertyMapping` annotation. This led to three
problems:

1. Properties that should have been included in the property source
   were not included
2. Properties that were included may have had the wrong name
3. Properties were included when they should not have been

`@DataJpaTests` provided a concrete example of all three problems:

1. The `replace` and `connection` attributes from
   `@AutoConfigureTestDatabase` were not included in the property
   source
2. The `showSql` attribute from `@DataJpaTest` was mapped as
   `spring.test.database.spring.jpa.show-sql`
3. The `useDefaultFilters` attribute from `@DataJpaTest` was included
   in the property source.

This commit updates AnnotationsPropertySource to consider
meta-annotations when looking for attributes that should be mapped.
This addresses the first problem. Furthermore,
AnnotationsPropertySource has been updated to no longer consider
meta-annotations when looking for a type-level property mapping.
This addresses the second and third problems.

Closes gh-5794
9 years ago
Phillip Webb 93382648ab Formatting 9 years ago
Johnny Lim 6d48ee9593 Polish
Closes gh-5714
9 years ago
Andy Wilkinson 35270e939f Update dependency management for Selenium and its HTMLUnit Driver
Closes gh-5705
9 years ago
Johnny Lim c154990024 Polish
Closes gh-5691
9 years ago
Phillip Webb 21bc166c95 Rename Import*AutoConfiguration classes
Rename Import*AutoConfiguration classes to AutoConfigure*.

Fixes gh-5692
9 years ago
Johnny Lim 90d897eb9d Polish
Closes gh-5685
9 years ago
Phillip Webb dbd577545d Remove trailing whitespace 9 years ago
Johnny Lim 10a73381e6 Remove a test doing nothing
Closes gh-5673
9 years ago
Phillip Webb b398b3319c Rename @SpringApplicationTest -> @SpringBootTest
Rename @SpringApplicationTest to SpringBootTest and
@SpringApplicationContextLoader to @SpringBootContextLoader.

Fixes gh-5562
9 years ago
Andy Wilkinson e41ccfae3c Correct javadoc tag 9 years ago
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
9 years ago
Andy Wilkinson f99bfccd51 Polishing 9 years ago
Andy Wilkinson b630b080ce Make it easier to customize the auto-configured MockMvcBuilder
Closes gh-5556
9 years ago
Phillip Webb 893a6c32f3 Upgrade to checkstyle 6.17
Fixes gh-5547
9 years ago
Johnny Lim a28dd9d9e6 Polish
Closes gh-5532
9 years ago
Stephane Nicoll 6be92675c2 Remove dependency version from child pom 9 years ago
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
9 years ago
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
9 years ago
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
9 years ago
Phillip Webb 56fd4e1f76 Add TypeExcludeFilters support
Provide a way for auto-configuration tests to easily filter scanned
components.

See gh-4901
9 years ago
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
9 years ago
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
9 years ago
Phillip Webb 6d934bb270 Add spring-boot-test-autoconfigure module
Add a new test module to deal with auto-configuration in tests.

See gh-4901
9 years ago