Commit Graph

202 Commits (0cfcfb104e2c1f81378d5a427f10cb9451017fa2)

Author SHA1 Message Date
Spring Buildmaster 88e43c8421 Next Development Version 8 years ago
Spring Buildmaster 9768b0a8c2 Next Development Version 8 years ago
Spring Buildmaster d719d2cbbc Next Development Version 8 years ago
Phillip Webb 8eb79b3c0f Polish 8 years ago
Phillip Webb f46d799f31 Polish 8 years ago
Madhura Bhave 9e2d54feae Support json view with JacksonTester
Closes gh-8672
8 years ago
Stephane Nicoll 934d33685a Polish
See gh-8879
8 years ago
Phillip Webb ad38776de3 Polish 8 years ago
Madhura Bhave f73714bdcc Do not filter HttpMessageConverters in WebMvcTest
Closes gh-8617
8 years ago
Spring Buildmaster d23fa24340 Next Development Version 8 years ago
Spring Buildmaster 2a83e80a9b Next Development Version 8 years ago
Phillip Webb ca1540cefe Update header copyright for changed files 8 years ago
Andy Wilkinson 98a2ae3b91 Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 1abd91dc23 Start building against Spring Framework 4.3.7 snapshots
See gh-8248
8 years ago
Johnny Lim 0adab8a2be Use logical 'and' instead of bitwise 'and'
Closes gh-8198
8 years ago
Johnny Lim 846994e498 Polish
Closes gh-8148
8 years ago
Spring Buildmaster 5c12500366 Next Development Version 8 years ago
Spring Buildmaster a2696bf873 Next Development Version 8 years ago
Phillip Webb fa6a138598 Refine ImportsContextCustomizer cache logic
Update `ImportsContextCustomizer` so that whenever possible a more
specific cache key is used.

Prior to this commit the customizer would generate a key based on *all*
annotations on the test class. This has repeatedly caused issues where
test classes that should have the same cache key did not due to
unrelated annotations.

A new `DeterminableImports` interface has been added that can be
implemented by `ImportSelector` and `ImportBeanDefinitionRegistrar`
implementations that are able to determine their imports early. The
existing `ImportAutoConfigurationImportSelector` and
`AutoConfigurationPackages` classes have been retrofitted with
this interface.

Fixes gh-7953
8 years ago
Phillip Webb aaf118c544 Fix TypeExcludeFiltersContextCustomer key
Update `TypeExcludeFiltersContextCustomer` to use filter instances
as part of the key, rather than class references. In order to be used
in tests, `TypeExcludeFilter` implementations must now implement valid
`hashCode` and `equals` methods.

Fixes gh-8125
8 years ago
Spring Buildmaster ed1ce140c0 Next Development Version 8 years ago
Phillip Webb 2c89d9918f Relocate AutoConfigurations from root package
Move PropertyPlaceholder and MessageSource auto-configuration from the
root package to the `context` subpackage.

Fixes gh-8071
8 years ago
Phillip Webb 5703fb1515 Polish 8 years ago
Stephane Nicoll 915c959a28 Polish contribution
Closes gh-7600
8 years ago
Michael J. Simons 8648520876 Add slide test annotation for MongoDB
This commits adds a slice test infrastructure for MongoDB, similar to
what `@DataJpaTest` does with JPA.

By default, an embedded Mongod process is used if available.

See gh-7600
8 years ago
Phillip Webb f3cd0ad22c Polish 8 years ago
Phillip Webb 655fa59db0 Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb b05bdbfe4f Polish 8 years ago
Stephane Nicoll e44b595c0d Fix merge issue 8 years ago
Stephane Nicoll d2299555d2 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll ffa6d6d6e0 Improve error message used in TestDatabaseAutoConfiguration
By default, `@DataJpaTest` (and `@AutoConfigureTestDatabase`) attempt to
replace any existing `DataSource` by an embedded one. Previously, if
there is was no embedded database on the classpath, the exception message
did not provide that context in the error message.

This commit clarifies the error message to conduct
`TestDatabaseAutoConfiguration` (that is replacing the existing
`DataSource`).

Closes gh-7797
8 years ago
Phillip Webb 0a6456a748 Always use `prefix` config annotation attribute
Update use of `@ConfigurationProperties` to prefer the more explicit
`prefix` attribute, rather than `value`.

See gh-7579
8 years ago
Stephane Nicoll 7a75fb0f38 Fix test-specific configuration metadata
Most of the config keys defined by the `spring-boot-test-autoconfigure`
module can't be overridden because they are mapped with `@PropertyMapping`
on an annotation. It is confusing that such keys are exposed in content
assistance as using them will have no effect.

This commit removes the annotation processor from the build so that the
`@ConfigurationProperties` beans aren't processed anymore. Instead, manual
metadata is written for the two only keys that are effectively used in
regular configuration.

As a result, the `additional-spring-configuration-metadata` file has been
renamed to `spring-configuration-metadata` since nothing is processing it
anymore.

Closes gh-7887
8 years ago
Phillip Webb e015e13b4d Include `ErrorAttributes` in @WebMvcTest
Import the additional auto-configuration classes required for
`ErrorAttributes` and change the filter so that it's no longer
hidden.

Fixes gh-7867
8 years ago
Johnny Lim f915ae197a Polish 8 years ago
Phillip Webb 54aeff47a2 Add exclude support to @ImportAutoConfiguration
Update `@ImportAutoConfiguration` with support for an exclude attribute
that works in a similar way to `@EnableAutoConfiguration`.

Also update existing `@Test...` annotation with exclude attribute
aliases.

Fixes gh-6809
8 years ago
Phillip Webb 8b69856fc9 Polish 8 years ago
Spring Buildmaster 9057f9ae1f Next development version 8 years ago
Phillip Webb 6121208cbb Polish formatting 8 years ago
Phillip Webb 4b9cba351b Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb bd74c3d327 Polish formatting 8 years ago
Stephane Nicoll 21b815aabd Polish contribution
Closes gh-7560
8 years ago
Eddú Meléndez 5a7624df7c Add support for property spring.test.database.replace
Closes gh-7229
8 years ago
Stephane Nicoll d8d5950e99 Enable validation in `AutoConfigureWebMvc`
Closes gh-7582
8 years ago
Stephane Nicoll ee72e788ed Rename `spring-boot-junit-runners` to `spring-boot-test-support`
Closes gh-7421
8 years ago
Johnny Lim 423f8037ce Polish
Closes gh-7530
8 years ago
Stephane Nicoll 80da80f930 Make sure that test data sources are unique 8 years ago
Stephane Nicoll ba61faee5e Remove trailing char 8 years ago
Stephane Nicoll b618c70e52 Add test slice for pure jdbc tests
This commit adds `@JdbcTest`, a new test slice for pure jdbc tests. It
provides the same basic features than `@DataJpaTest`.

Closes gh-6563
8 years ago
Phillip Webb 5ed00b3501 Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb 357d072a60 Polish 8 years ago
Stephane Nicoll ca788a90e6 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll 4bf645c615 `AutoconfigureTestDatabase` replace with a fresh database
Previously, two or more `@DataJpaTest` tests in the same test suite were
sharing the same in-memory database instance. This commit makes sure
that `TestDatabaseAutoConfiguration` creates a unique embedded database
for each test it operates on.

Closes gh-7473
8 years ago
Phillip Webb dc237043b8 Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb 74670cb20f Allow WebDriver beans to define their own scope
Update `WebDriverScope` so that only `WebDriver` beans with no explicit
scope are moved.

Fixes gh-7454
8 years ago
Andy Wilkinson b2a8be8bbe Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 3423ca87b4 Ensure that RestClientTest can be used without Jackson on the class path
Closes gh-7431
8 years ago
Phillip Webb 764f13453a Merge branch '1.4.x' into 1.5.x 8 years ago
Phillip Webb bacf0878af Polish 8 years ago
Spring Buildmaster e712a9ba8c Next Development Version 8 years ago
Stephane Nicoll 5878e5eec5 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll 318701daa7 Apply DispatcherServlet customizations to MockMvc
This commits makes sure that customizations on `DispatcherServlet` are
also applied to the `TestDispatcherServlet` that `MockMvc` is using
internally.

Closes gh-5891
8 years ago
Stephane Nicoll 3018e95261 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll ebfd86ea26 Polish contribution
Closes gh-7326
8 years ago
sebastiankirsch e8b0a64872 Add @Inherited to all AutoConfigure* classes
See gh-7326
8 years ago
Phillip Webb 5b66ffbb4b Merge branch '1.4.x' into 1.5.x 8 years ago
Greg Potter 39d5881bf2 Respect 'primary' flag when replacing databases
Update TestDatabaseAutoConfiguration to ensure that the the `primary`
flag of the `BeanDefinition` is copied.

Closes gh-7217
8 years ago
Stephane Nicoll 4855bfb152 Merge branch '1.4.x' into 1.5.x 8 years ago
Stephane Nicoll a03ce0a9d1 Polish contribution
Add missing test

Closes gh-7193
8 years ago
Johnny Lim 0b5fbbedf4 Add a missing return
This commit adds a missing`return` in `getDataSourceBeanDefinition()`.

See gh-7193
8 years ago
Stephane Nicoll 6bd670edbc Initiate 1.4.x branch 8 years ago
Spring Buildmaster 7e9ed5e1a7 Next Development Version 8 years ago
Johnny Lim a994b11a73 Polish 8 years ago
Phillip Webb e239e64cb1 Only print MVC interactions when tests fail
Update `@AutoConfigureMockMvc` with a `printOnlyOnFailure` option which
allows errors to be printed only when tests fail. Defaults to `true`
meaning the logs are no longer cluttered with MVC results for passing
tests.

Fixes gh-6653
8 years ago
Andy Wilkinson 0a9bcd9893 Polish 8 years ago
Phillip Webb ac2609b585 Fix WebDriver lifecycle issues
Update WebDriver support to ensure that the `.quit()` method is called
after each test method runs and that a new WebDriver instance is
injected each time.

Support is provided by introducing a new `Scope` which is applied by
a ContextCustomizerFactory and reset by a TestExecutionListener.

Fixes gh-6641
8 years ago
Phillip Webb 0ef845b96e Polish 8 years ago
Phillip Webb 82ae6e4049 Improve @AutoConfigureTestDatabase failure message
Fixes gh-6916
8 years ago
Phillip Webb 2c621f4094 Fix @AutoConfigureTestDatabase imports
Update `@AutoConfigureTestDatabase` so that it always imports
`DataSourceAutoConfiguration`. Prior to this commit the annotation
could only be applied if something else also imported DataSource
auto-configuration.

Fixes gh-6897
8 years ago
Phillip Webb 3e19f8aa8d Relax TestEntityManager @ID restriction
Change TestEntityManager so that entities with an ID can be persisted.

Fixes gh-6546
8 years ago
Phillip Webb 25c4e261e9 Fix failing tests
See gh-6897
8 years ago
Phillip Webb 46815fc483 Fix potential @AutoConfigureTestDatabase NPE
Protect against the situation where no DataSource beans can be found
at all.

Fixes gh-6897
8 years ago
Phillip Webb ebb08c3655 Generate property meta-data for test projects
Add annotation processor to `spring-boot-test` and
`spring-boot-test-autoconfigure`.

Fixes gh-6893
8 years ago
Phillip Webb 7134586310 Ensure test @PostConstructs are only called once
Rename AutoConfigureReportTestExecutionListener to
SpringBootDependencyInjectionTestExecutionListener and ensure that it
replaces any existing DependencyInjectionTestExecutionListener.

Prior to this commit the registration of two DependencyInjection
listeners would cause @PostConstruct methods on tests to be called
twice.

In order to allow the standard DependencyInjectionTestExecutionListener
to be removed a new DefaultTestExecutionListenersPostProcessor interface
has been introduced.

Fixes gh-6874
8 years ago
Phillip Webb 41a36c4d40 Prevent CastCastException when stripping root URI
Update RootUriRequestExpectationManager to only wrap requests when
they cannot be cast to MockClientHttpRequest. This prevents later
ClassCastExceptions from being thrown with @RestClientTests that
define expected body content.

Fixes gh-6845
8 years ago
Phillip Webb 41dc53f5dd Polish 8 years ago
Stephane Nicoll 52d7282f5e Auto-configure JdbcTemplate with DataJpaTest
This commit adds `JdbcTemplateAutoConfiguration` to the list of auto-
configurations that are applied with `DataJpaTest`. This effectively
allows to inject a `JdbcTemplate` in any `@DataJpaTest` test.

Closes gh-6802
8 years ago
Stephane Nicoll 2c61064d93 Fix property prefix
This commit fixes the prefix for the WebClient and WebDriver auto-config
so that it complies with the prefix set on `AutoconfigureWebMvc`

Closes gh-6727
8 years ago
Johnny Lim 524edaea51 Polish
Closes gh-6728
8 years ago
Andy Wilkinson 5f7e966955 Enable MessageSourceAutoConfiguration when using @WebMvcTest
Closes gh-6608
8 years ago
Phillip Webb f38bd7af37 Extract GSON/Jackson config to inner classes
Update JsonTestersAutoConfiguration so that GSON and Jackson specific
configuration are inner classes. This should prevent ClassNotFound
exception when the libraries are not on the classpath.

Fixes gh-6502
8 years ago
Brian Clozel d62827373d Fix Bean Condition on GsonTester FactoryBean
This commit fixes the `@ConditionalOnClass` typo on the GsonTester
FactoryBean, which was testing for `ObjectMapper` instead of `Gson`.

This means that the next condition `@ConditionalOnBean(Gson.class)`
throws a `ClassNotFoundException: com.google.gson.Gson` since it's
trying to load that class to check for an existing Bean of that type.

Fixes gh-6502
8 years ago
Spring Buildmaster 334baaeffd Next development version 8 years ago
Phillip Webb 5d9836b3b1 Refine unmapped property support
Replace `@UnmappedPropertyValue` with a `skip` attribute on
`@PropertyMapping` so that any default attribute value can be skipped.

Closes gh-6455
8 years ago
Phillip Webb 162b9e84a3 Polish 8 years ago
Phillip Webb 296dc7132b Allow JSON Testers to be `@Autowired`
Switch `@AutoConfigureJsonTesters` to use regular `@Autowired` injection
for JSON testers. Prior to this commit JSON Tester fields were
initialized directly which caused IDE issues and was also a little
confusing.

Fixes gh-6451
8 years ago
Phillip Webb 4a1e0d4544 Extend @AutoConfigureMockMvc print support
Update @AutoConfigureMockMvc to support extended print options including
`System.err` and `log.debug`. In addition the "default" print option
can now be overridden by adding `spring.test.mockmvc.print=...` to
`src/test/resources/application.properties`.

Fixes gh-6455
8 years ago
Phillip Webb 8355d8516b Add @UnmappedPropertyValue support
Update @PropertyMapping support to allow single enum values to be marked
as an @UnmappedPropertyValue. This change is primarily so that users can
replace "default" values globally for across all tests.

See gh-6455
8 years ago
Phillip Webb c265de2535 Use @AliasFor in @AutoConfigureRestDocs
Replace custom alias logic in @AutoConfigureRestDocs with @AliasFor.

Closes gh-6403
8 years ago
Andy Wilkinson 3286760073 Make it easier to add auto-configuration to a test slice
Previously, an entry had to be added to spring.factories using the
name of one of the @AutoConfigure… meta-annotations on the @…Test
annotation as the key. This indirection was unnecessarily complicated.

This commit simplifies things by allowing the name of the @…Test
annotation itself to be used as the key.

Closes gh-6335
8 years ago