Commit Graph

367 Commits (a056eb475a16ad6718d6ab073efd4300b42cdf44)

Author SHA1 Message Date
Madhura Bhave ac10ebba33 Fix checkstyle 5 years ago
Madhura Bhave c82d728c93 Merge branch '2.2.x'
Closes gh-19561
5 years ago
Madhura Bhave 67fab60fbd Merge branch '2.1.x' into 2.2.x
Closes gh-19560
5 years ago
Scott Frederick 487b9cbf96 Add profiles directly to the application environment for tests
Prior to this commit, active profiles were being added to the Spring Boot
application environment by setting the `spring.profiles.active` property.
This could result in profiles getting parsed differently than other uses of `@ActiveProfiles`.
Setting the profiles directly in the `Environment` prevents this parsing.

See gh-19556
5 years ago
Stephane Nicoll 2c1e81adf0 Polish 5 years ago
Andy Wilkinson 9b0569cf81 Merge branch '2.1.x' into 2.2.x
Closes gh-19309
5 years ago
Andy Wilkinson bc53fe0344 Recommend mockito-inline for mocking and spying of CGLib proxies
This reverts commit 52050c173c.

See gh-17817
Closes gh-19020
5 years ago
Stephane Nicoll fd94608f73 Polish "Restore proxying of @Bean methods in @TestConfiguration"
See gh-18675
5 years ago
Dmytro Nosan 7faa606920 Restore proxying of @Bean methods in @TestConfiguration
See gh-18675
5 years ago
Stephane Nicoll 0bc5803e34 Merge branch '2.1.x'
Closes gh-18603
5 years ago
Stephane Nicoll e4ba6049ff Clarify scope of "@SpringBootTest#classes"
See gh-18229
5 years ago
Johnny Lim 887c3b71f3 Fix matchesNestedConfigurationClassWithoutTestMethodsIfItHasTestable()
See gh-18559
5 years ago
Andy Wilkinson 96f85a40de Support customization of WebTestClient.Builder when using @SpringBootTest
Closes gh-15132
5 years ago
Andy Wilkinson 46c30d6bb0 Merge branch '2.1.x'
Closes gh-18476
5 years ago
Andy Wilkinson 3d4157ad6d Correct SCM URLs in published poms
Previously, Maven's default behaviour was relied up which resulted
in the artifact ID being appended to each URL as it was inherited.
This behaviour can only be disabled in Maven 3.6 and later, a version
that we cannot use due to an incompatibility with the Flatten Plugin.

This commit works around Maven's default behaviour by defining
properties for the SCM URL, connection, and developer connection and
then explicitly defining the settings in each pom using these
properties. The explicit definition of the properties in each pom
prevents them being inherited from the parent, thereby disabling the
unwanted appending of the artifact ID to the URL.

Fixes gh-18328
5 years ago
Phillip Webb b65ba60980 Polish 'Simplify some code'
See gh-18438
5 years ago
kenneth e6b45de41e Simplify some code
See gh-18438
5 years ago
Stephane Nicoll c605419f19 Merge branch '2.1.x'
Closes gh-18379
5 years ago
Roland Weisleder 92ae7b21a1 Fix typo in ApplicationContextAssert
See gh-18372
5 years ago
Phillip Webb ad32603635 Restore compatibility with MockRestServiceServer
Closes gh-17885
5 years ago
Stephane Nicoll 3d5530d15d Merge branch '2.1.x'
Closes gh-18234
5 years ago
Stephane Nicoll 9065c4997d Fix rebase from master 5 years ago
Stephane Nicoll e05f42f0f3 Polish Add Testable to CLASS_ANNOTATIONS in TestTypeExcludeFilter"
See gh-18214
5 years ago
Leonard Brünings b9c8d7dd60 Add Testable to CLASS_ANNOTATIONS in TestTypeExcludeFilter
See gh-18214
5 years ago
dreis2211 b4350a9d96 Remove unnecessary blank lines
See gh-18089
5 years ago
dreis2211 3e35a6616c Fix duplicated words
See gh-18004
5 years ago
Andy Wilkinson ba6fe60134 Merge branch '2.1.x'
Closes gh-17948
5 years ago
Andy Wilkinson 52050c173c Fix spying on scoped beans with @SpyBean
Previously, when spying on a scoped bean the creation of the spy
would be performed using the scoped proxy. This would result in
the spy being unable to spy on any of the target bean's methods as
the scoped proxy's implementations of those methods would be final.

This commit updates MockitoPostProcessor so that the creation of the
spy and injection of the @SpyBean-annotated field is performed using
the scoped target. The scoped target has not be proxied so this
allows Mockito to spy on all of its methods.

Closes gh-17817
5 years ago
Andy Wilkinson ab87b2a39b Polish 5 years ago
dreis2211 d4affd7f85 Use hasSize() assertion in favor of length checks
See gh-17874
5 years ago
Phillip Webb 34c31ce099 Remove BeanTypeRegistry
Remove `BeanTypeRegistry` and rely entirely on standard calls Spring
Framework APIs.

Closes gh-17594
5 years ago
Phillip Webb da4f436140 Change SearchStrategy EXHAUSTIVE to TYPE_HIERARCHY
Fixup references following upstream Spring Framework change.
5 years ago
dreis2211 8d2f2b75bd Upgrade to AssertJ 3.13.1
See gh-17690
5 years ago
Phillip Webb 8bc780762a Merge branch '2.1.x' 5 years ago
Phillip Webb fb1dd8fe93 Merge branch '2.0.x' into 2.1.x 5 years ago
Phillip Webb 913e831f4e Merge '1.5.x' into 2.0.x 5 years ago
Phillip Webb 6c0dbacfce Polish 5 years ago
Phillip Webb 0d92af7d55 Add hasJsonPath and doesNotHaveJsonPath asserts
Extend `JsonContentAssert` with `hasJsonPath` and `doesNotHaveJsonPath`
methods which can be used to check the path regardless of the value it
may or may not contain.

Prior to this commit there wasn't an easy way to assert that the
Jackson `@JsonInclude(JsonInclude.Include.NON_NULL)` annotation was
applied since `assertDoesNotHavePathValue` would pass for both
`{"name" : null}` and `{}`.

Closes gh-17608
5 years ago
Phillip Webb 900ec9f3ec Fix error message formatting placeholders
Fix the formatting message placeholders to '%s' since '{}' isn't
supported by AssertJ.

See gh-15569
5 years ago
Andy Wilkinson 41957ec2ad Polish "Polish OutputCapture and its JUnit Jupiter extension"
See gh-17049
5 years ago
Sam Brannen e1c595a67f Polish OutputCapture and its JUnit Jupiter extension
- Polish Javadoc
- Improve error message in OutputCapture
- Use ExtensionContext.Store in OutputCaptureExtension

See gh-17049
5 years ago
Phillip Webb a9ba7080ce Merge branch '2.1.x' 5 years ago
Phillip Webb eff1147ccc Rename classpath runner package
Remove `runner` since we're no longer tied to JUnit 4.

See gh-17491
5 years ago
Phillip Webb 1117fdb2b3 Make ModifiedClassPathExtension package private
Meta-annotate `ClassPathExclusions` and `ClassPathOverrides` with
so that the `ModifiedClassPathExtension` no longer needs to be
used directly.

See gh-17491
5 years ago
dreis2211 0f0278e69b Migrate ModifiedClassPath tests to JUnit 5
Migrate the remaining JUnit 4 tests to JUnit 5, making use of the
new `ModifiedClassPathExtension`.

See gh-17491
5 years ago
Phillip Webb 0cb6a7f47d Polish 5 years ago
Phillip Webb 01933f9b06 Merge previously split strings
Merge some string lines that were previously split because of the
90 chars wide formatting.
5 years ago
Phillip Webb cdf43a7489 Polish 5 years ago
Phillip Webb 8d4a2add63 Allow OutputCaptureRule to be used with AssertJ
Update `OutputCaptureRule` so that it now implements
`CapturedOutput` and can be used directly with AssertJ.

Closes gh-17512
5 years ago
dreis2211 82047a2544 Polish
See gh-17505
5 years ago
Johnny Lim 426ef749db Polish
See gh-17413
5 years ago
Andy Wilkinson 2816635418 Polish 5 years ago
Phillip Webb a66c4d3096 Unify method visibility of private classes
Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.

Closes gh-7316
5 years ago
Phillip Webb 605599138e Merge branch '2.1.x' 5 years ago
Phillip Webb 92bff3c328 Merge branch '2.0.x' into 2.1.x 5 years ago
Phillip Webb cfeb0239b7 Merge branch '1.5.x' into 2.0.x 5 years ago
Stephane Nicoll e560b7f6ba Remove public modifier on JUnit5 lifecycle methods
See gh-17292
5 years ago
Andy Wilkinson a189e4cf96 Merge branch '2.1.x'
Closes gh-17220
6 years ago
Andy Wilkinson 645514f848 Polish "Honour base path from @WebAppConfiguration in @WebMvcTest"
See gh-16485
6 years ago
Lorenzo Dee 7340d546b8 Honour base path from @WebAppConfiguration in @WebMvcTest
See gh-16485
6 years ago
Madhura Bhave 30cfe7b4c5 Polish 6 years ago
Phillip Webb aad21d1996 Polish "Support default headers with RestTemplateBuilder"
Broaden the scope of customizer support so that instead of focusing
just on headers, we can now customize any outgoing `HttpClientRequest`.
Also update auto-configuration to automatically add any
`RestTemplateRequestCustomizer` beans to the builder.

See gh-17091
6 years ago
Ilya Lukyanovich 43b1a667ce Support default headers with RestTemplateBuilder
Update `RestTemplateBuilder` so that it is easier to apply custom
headers to the outgoing request. The update is particularly useful
for setting the `User-Agent` header, for example so that a GitHub
username can be used when calling `api.github.com`.

See gh-17091
6 years ago
Phillip Webb 266d6334b2 Fix checkstyle RedundantModifier test violations 6 years ago
Andy Wilkinson b18fffaf14 Move tests to JUnit 5 wherever possible 6 years ago
Andy Wilkinson aef92b9295 Merge branch '2.1.x'
Closes gh-17079
6 years ago
Andy Wilkinson 24925c3dae Merge branch '2.0.x' into 2.1.x
Closes gh-17078
6 years ago
Andy Wilkinson c6c139d980 Merge branch '1.5.x' into 2.0.x 6 years ago
Phillip Webb db75347eb6 Merge branch '2.1.x' 6 years ago
Phillip Webb 0ef331018e Merge branch '2.0.x' into 2.1.x 6 years ago
Phillip Webb 7fc01971ed Merge branch '1.5.x' into 2.0.x 6 years ago
Phillip Webb 76e075ddd0 Polish "Use request factory to support Basic Authentication"
Reduce the surface area of the public API by making the
`BasicAuthentication` and `BasicAuthenticationClientHttpRequestFactory`
class package private.

This commit also attempts to simplify `TestRestTemplate` by keeping
the `RestTemplateBuilder` and reusing it, rather than needing to deal
only with a `RestTemplate` instance.

See gh-17010
6 years ago
Dmytro Nosan 18a0a7a2e8 Use request factory to support Basic Authentication
Update `RestTemplateBuilder` to use a custom request factory to add
authentication headers rather than an interceptor.

Prior to this commit, the use of the `BasicAuthenticationInterceptor`
interceptor could cause `OutOfMemoryError` whenever a large file is
uploaded.

See gh-17010
6 years ago
Madhura Bhave 898a903d2f Fix typos in javadoc 6 years ago
Andy Wilkinson 0644a79401 Repackage output capture and always use extension declaratively
Closes gh-17029
6 years ago
Phillip Webb d11d5ceb29 Split up JUnit 5 OutputCapture class
Split the JUnit 5 `OutputCapture` class into separate `OutputExtension`
and `CapturedOutput` classes. The JUnit 5 callback methods are now
contained only in the `OutputExtension` class so no longer pollute the
public API that users will interact with.

The `CapturedOutput` class has also been updated to capture System.err
and System.out separately to allow distinct assertions if required.

Closes gh-17029
6 years ago
Phillip Webb 68aec8b6ee Polish 6 years ago
Andy Wilkinson 86380ab8db Add missing package-info.java files 6 years ago
Johnny Lim d8e5169f5f Polish
Closes gh-16948
6 years ago
Andy Wilkinson 23f803c6b6 Upgrade to Hamcrest 2.1, switch to hamcrest artifact from -core and -library
Closes gh-15555
6 years ago
dreis2211 27ca7e17d9 Fix deprecated StandardAnnotationMetadata usages
Closes gh-16930
6 years ago
Phillip Webb ed998ef0d3 Update copyright header of changed files 6 years ago
Andy Wilkinson 552345fcd1 Disable more @Bean method proxying
Previously, due to a quirk in Spring Framework, it was necessary to use bean method
proxying in @Configuration classes that define one or more FactoryBeans. This quirk has
now been addressed so this commit disables bean method proxying where it is now no longer
needed.

Closes gh-16533
6 years ago
Andy Wilkinson ca51609cdf Align mock with Selenium HtmlUnit's new behaviour
See gh-16801
6 years ago
Madhura Bhave 1db1c8b03c Validate our own tests work with JUnit5 and the vintage engine
Closes gh-14737

Co-authored-by: Stephane Nicoll <snicoll@pivotal.io>
6 years ago
Madhura Bhave d15347d4e5 Add Junit5 OutputCapture Extension
Closes gh-14738
6 years ago
Stephane Nicoll c91578bbae Define surefire test provider to use
The `spring-boot-test` module has a dependency to TestNG to validate
some part of the test infrastructure but no tests are actually written
using TestNG. The presence of TestNG is a trigger for the maven surefire
plugin and it attempts to run tests using it.

This commit defines the explicit provider to use (JUnit 4)

Closes gh-16735
6 years ago
Phillip Webb 32040e355b Merge branch '2.1.x'
Closes gh-16649
6 years ago
Phillip Webb d4151e0b51 Polish "Use Jackson configuration with JsonPath"
Polish contribution to use a factory method in `AbstractJsonMarshalTester`
rather than additional constructor arguments.

Also change the `JsonContent` tests so that the `Configuration` constructor
is package private. This keeps JsonPath classes out of our public API, at
the expense of limiting custom JsonPath configurations to just our code.

See gh-16629
6 years ago
Phillip Webb 17aaf26590 Use consistent javadoc style for annotation links
Closes gh-13920
6 years ago
Phillip Webb 1e44aba772 Fix compiler warnings and polish
Fix various compiler warnings and apply a little polish.
6 years ago
Diego Berrueta 756a7f12a3 Use Jackson configuration with JsonPath
Update `JacksonTester` so that the JsonPath instance is explicitly configured
with both a `JacksonJsonProvider` and a `JacksonMappingProvider`.

Prior to this commit, the handling of special characters was not symmetrical
between the serialization (handled via the JacksonTester) and the parsing (handled
via JsonPath) due to the fact that JsonPath used `SimpleJson` as its parser.

See gh-16629
6 years ago
Phillip Webb b879972d0d Migrate to MergedAnnotations API
Migrate away from `AnnotationUtils` and `AnnotatedElementUtils`
when possible to the new `MergedAnnotations` API.

Closes gh-16551
6 years ago
Phillip Webb 5f1bbf8c72 Update copyright header of changed files 6 years ago
Phillip Webb 7d4118a0fe Align withBean methods with ApplicationContext
Rework `AbstractApplicationContextRunner.withBean` methods to
align signatures as much as possible with those provided by
the `ApplicationContext`.

Also update the implementation to use a dedicate member
variable rather than adding initializers.

Closes gh-16011
6 years ago
Phillip Webb 2dfd916c96 Polish 6 years ago
Stephane Nicoll a780875390 Allow `ApplicationContextRunner` to accept simple bean definitions
This commit adds `withBean` methods to the `ApplicationContextRunner`
abstraction so that simple beans can be registered inline. This is a
nice alternative for cases where a inner configuration class has to be
defined for the purpose of creating a simple bean.

Closes gh-16011
6 years ago
Stephane Nicoll c432288ed1 Migrate ApplicationContext to common hierarchy
This commit migrates `AnnotationConfigReactiveWebApplicationContext`
parent to the `GenericApplicationContext` abstraction. Any use of
`AnnotationConfigWebApplicationContext` is also removed as it also
inherits from the `AbstractRefreshableApplicationContext` outdated
hierarchy.

A new `AnnotationConfigServletWebApplicationContext` context is
introduced instead, extending from `GenericApplicationContext` and
providing the counter part of the reactive context for the Servlet-based
web app tests.

See gh-16096
6 years ago
Phillip Webb ad7eebee9e Merge branch '2.1.x' 6 years ago
Phillip Webb f12ab1ff90 Update copyright header of changed files 6 years ago