Commit Graph

389 Commits

Author SHA1 Message Date
dreis2211
674f1e77b5 Fix typos
See gh-20704
2020-03-28 08:42:59 +01:00
dreis2211
ef9f1d39a3 Remove redundant MockitoAnnotations.initMocks()
See gh-20601
2020-03-22 08:43:50 +01:00
dreis2211
a9dabe13bb Remove redundant useJUnitPlatform declarations
See gh-20206
2020-02-17 09:15:57 +01:00
dreis2211
20251ccae4 Remove superfluous useJUnit()
See gh-20035
2020-02-06 16:54:51 +01:00
Phillip Webb
1eee83a07e Update copyright year of changed files 2020-01-30 17:09:49 -08:00
Stephane Nicoll
eb852f1ad6 Disable bean overriding by default in ApplicationContextRunner
For consistency with SpringApplication, this commit disables bean
overriding by default in ApplicationContextRunner. Bean overriding can
be enabled again using withAllowBeanDefinitionOverriding.

Closes gh-18019
2020-01-28 15:57:28 +01:00
Stephane Nicoll
95be419527 Use Class.forName rather than ClassLoader.loadClass
This commit changes uses of ClassLoader.loadClass to Class.forName for
consistency with what was initiated in #19342 and better compatibility
with GraalVM.

Closes gh-19824
2020-01-23 10:47:53 +01:00
Phillip Webb
e0013454b5 Use parentheses when declaring dependencies
Update all dependencies declarations to use the form `scope(reference)`
rather than `scope reference`.

Prior to this commit we declared dependencies without parentheses unless
we were forced to add them due to an `exclude`.
2020-01-22 16:02:38 -08:00
Phillip Webb
0209cd3e4c Polish quote form used in Gradle scripts
Replace Gradle single quote strings with the double quote form
whenever possible. The change helps to being consistency to the
dependencies section where mostly single quotes were used, but
occasionally double quotes were required due to `${}` references.
2020-01-22 15:49:52 -08:00
dreis2211
042694bc53 Reinstate running of OutputCaptureRuleTests
See gh-19826
2020-01-21 09:47:41 +01:00
Andy Wilkinson
29d8b6db5a Merge branch '2.2.x'
Closes gh-19822
2020-01-20 15:18:18 +00:00
Andy Wilkinson
f708aace65 Merge branch '2.1.x' into 2.2.x
Fixes gh-19821
2020-01-20 15:18:00 +00:00
Andy Wilkinson
c85f19b75b Revert "Add profiles directly to the application environment for tests"
This reverts commit 487b9cbf96.

Fixes gh-19788
2020-01-20 15:01:09 +00:00
Scott Frederick
8f102aee68 Remove deprecated 2.2 code
See gh-19699
2020-01-16 14:44:52 +01:00
Andy Wilkinson
714a187d8f Rework dep mgmt again to avoid consumers picking up strict constraints
This paves the way for publishing Gradle module metadata once the
problem caused by snapshot versions and our two-step publication
process has been addressed.

See gh-19609
2020-01-15 12:33:18 +00:00
Andy Wilkinson
aefe52e4d0 Revert "Rework dep management to avoid consumers picking up strict constraints"
This reverts commit b34a311d02 as,
having disabled the publishing of Gradle's module metadata (4f75ab5),
the changes are no longer needed.

See gh-19609
2020-01-14 12:15:53 +00:00
Phillip Webb
f57281340c Merge branch '2.2.x' 2020-01-13 16:46:49 -08:00
Phillip Webb
3cfbfebbb1 Merge branch '2.1.x' into 2.2.x 2020-01-13 16:45:40 -08:00
Phillip Webb
9bd49562fe Update copyright year of changed files 2020-01-13 14:09:11 -08:00
Andy Wilkinson
b34a311d02 Rework dep management to avoid consumers picking up strict constraints
Previously, enforcedPlatform dependencies were using to pull in the
constraints defined in spring-boot-dependencies and
spring-boot-parent and applied them strictly so that the constrained
version had to be used. This worked as intended in Spring Boot's own
build but incorrectly enforced those same strict version requirements
on external consumers of Spring Boot's modules.

This commit reworks how Spring Boot defines its internal dependency
management so that platform dependencies are exposed to external
consumers while enforced platform dependencies are using internally.

See gh-19609
2020-01-13 19:59:56 +00:00
Andy Wilkinson
ce99db1902 Port the build to Gradle
Closes gh-19609
Closes gh-19608
2020-01-10 14:15:35 +00:00
Madhura Bhave
6944e52052 Merge branch '2.2.x' 2020-01-07 13:49:43 -08:00
Madhura Bhave
ac10ebba33 Fix checkstyle 2020-01-07 13:49:02 -08:00
Madhura Bhave
c82d728c93 Merge branch '2.2.x'
Closes gh-19561
2020-01-07 13:34:43 -08:00
Madhura Bhave
67fab60fbd Merge branch '2.1.x' into 2.2.x
Closes gh-19560
2020-01-07 13:33:32 -08:00
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
2020-01-07 13:23:09 -08:00
Stephane Nicoll
2c1e81adf0 Polish 2019-12-26 10:42:40 +01:00
Andy Wilkinson
9b0569cf81 Merge branch '2.1.x' into 2.2.x
Closes gh-19309
2019-12-05 16:15:15 +00:00
Andy Wilkinson
bc53fe0344 Recommend mockito-inline for mocking and spying of CGLib proxies
This reverts commit 52050c173c.

See gh-17817
Closes gh-19020
2019-12-05 16:13:02 +00:00
Stephane Nicoll
fd94608f73 Polish "Restore proxying of @Bean methods in @TestConfiguration"
See gh-18675
2019-10-22 09:13:00 +02:00
Dmytro Nosan
7faa606920 Restore proxying of @Bean methods in @TestConfiguration
See gh-18675
2019-10-22 09:10:05 +02:00
Stephane Nicoll
0bc5803e34 Merge branch '2.1.x'
Closes gh-18603
2019-10-15 14:38:59 +02:00
Stephane Nicoll
e4ba6049ff Clarify scope of "@SpringBootTest#classes"
See gh-18229
2019-10-15 14:36:28 +02:00
Johnny Lim
887c3b71f3 Fix matchesNestedConfigurationClassWithoutTestMethodsIfItHasTestable()
See gh-18559
2019-10-12 16:51:53 +01:00
Andy Wilkinson
96f85a40de Support customization of WebTestClient.Builder when using @SpringBootTest
Closes gh-15132
2019-10-02 17:51:00 +01:00
Andy Wilkinson
46c30d6bb0 Merge branch '2.1.x'
Closes gh-18476
2019-10-02 10:48:57 +01:00
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
2019-10-02 10:48:30 +01:00
Phillip Webb
b65ba60980 Polish 'Simplify some code'
See gh-18438
2019-10-01 22:08:20 -07:00
kenneth
e6b45de41e Simplify some code
See gh-18438
2019-10-01 22:08:02 -07:00
Stephane Nicoll
c605419f19 Merge branch '2.1.x'
Closes gh-18379
2019-09-27 16:34:59 +02:00
Roland Weisleder
92ae7b21a1 Fix typo in ApplicationContextAssert
See gh-18372
2019-09-27 16:32:32 +02:00
Phillip Webb
ad32603635 Restore compatibility with MockRestServiceServer
Closes gh-17885
2019-09-16 10:17:41 +02:00
Stephane Nicoll
3d5530d15d Merge branch '2.1.x'
Closes gh-18234
2019-09-16 10:03:19 +02:00
Stephane Nicoll
9065c4997d Fix rebase from master 2019-09-16 09:52:55 +02:00
Stephane Nicoll
e05f42f0f3 Polish Add Testable to CLASS_ANNOTATIONS in TestTypeExcludeFilter"
See gh-18214
2019-09-16 09:44:01 +02:00
Leonard Brünings
b9c8d7dd60 Add Testable to CLASS_ANNOTATIONS in TestTypeExcludeFilter
See gh-18214
2019-09-16 09:42:55 +02:00
dreis2211
b4350a9d96 Remove unnecessary blank lines
See gh-18089
2019-09-03 08:48:10 +02:00
dreis2211
3e35a6616c Fix duplicated words
See gh-18004
2019-09-01 09:09:38 +02:00
Andy Wilkinson
ba6fe60134 Merge branch '2.1.x'
Closes gh-17948
2019-08-23 19:15:02 +01:00
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
2019-08-23 19:03:08 +01:00
Andy Wilkinson
ab87b2a39b Polish 2019-08-19 16:05:43 +01:00
dreis2211
d4affd7f85 Use hasSize() assertion in favor of length checks
See gh-17874
2019-08-17 06:39:41 +02:00
Phillip Webb
34c31ce099 Remove BeanTypeRegistry
Remove `BeanTypeRegistry` and rely entirely on standard calls Spring
Framework APIs.

Closes gh-17594
2019-08-01 10:15:15 +01:00
Phillip Webb
da4f436140 Change SearchStrategy EXHAUSTIVE to TYPE_HIERARCHY
Fixup references following upstream Spring Framework change.
2019-07-31 15:11:43 +01:00
dreis2211
8d2f2b75bd Upgrade to AssertJ 3.13.1
See gh-17690
2019-07-30 09:48:33 +02:00
Phillip Webb
8bc780762a Merge branch '2.1.x' 2019-07-24 11:42:48 +01:00
Phillip Webb
fb1dd8fe93 Merge branch '2.0.x' into 2.1.x 2019-07-24 11:41:32 +01:00
Phillip Webb
913e831f4e Merge '1.5.x' into 2.0.x 2019-07-24 11:39:58 +01:00
Phillip Webb
6c0dbacfce Polish 2019-07-23 15:43:51 +01:00
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
2019-07-23 15:43:51 +01:00
Phillip Webb
900ec9f3ec Fix error message formatting placeholders
Fix the formatting message placeholders to '%s' since '{}' isn't
supported by AssertJ.

See gh-15569
2019-07-23 15:43:51 +01:00
Andy Wilkinson
41957ec2ad Polish "Polish OutputCapture and its JUnit Jupiter extension"
See gh-17049
2019-07-18 17:46:56 +01:00
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
2019-07-18 17:46:55 +01:00
Phillip Webb
a9ba7080ce Merge branch '2.1.x' 2019-07-17 21:48:42 +01:00
Phillip Webb
eff1147ccc Rename classpath runner package
Remove `runner` since we're no longer tied to JUnit 4.

See gh-17491
2019-07-15 13:40:26 +01:00
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
2019-07-15 13:38:26 +01:00
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
2019-07-15 00:31:03 +01:00
Phillip Webb
0cb6a7f47d Polish 2019-07-15 00:24:19 +01:00
Phillip Webb
01933f9b06 Merge previously split strings
Merge some string lines that were previously split because of the
90 chars wide formatting.
2019-07-15 00:24:19 +01:00
Phillip Webb
cdf43a7489 Polish 2019-07-14 19:42:56 +01:00
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
2019-07-14 19:42:42 +01:00
dreis2211
82047a2544 Polish
See gh-17505
2019-07-14 11:38:40 +02:00
Johnny Lim
426ef749db Polish
See gh-17413
2019-07-09 07:40:30 +02:00
Andy Wilkinson
2816635418 Polish 2019-07-04 17:51:20 +01:00
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
2019-07-03 11:39:47 -07:00
Phillip Webb
605599138e Merge branch '2.1.x' 2019-06-28 23:56:02 -07:00
Phillip Webb
92bff3c328 Merge branch '2.0.x' into 2.1.x 2019-06-28 23:42:28 -07:00
Phillip Webb
cfeb0239b7 Merge branch '1.5.x' into 2.0.x 2019-06-28 23:28:34 -07:00
Stephane Nicoll
e560b7f6ba Remove public modifier on JUnit5 lifecycle methods
See gh-17292
2019-06-21 18:09:05 +02:00
Andy Wilkinson
a189e4cf96 Merge branch '2.1.x'
Closes gh-17220
2019-06-17 14:05:16 +01:00
Andy Wilkinson
645514f848 Polish "Honour base path from @WebAppConfiguration in @WebMvcTest"
See gh-16485
2019-06-17 13:54:41 +01:00
Lorenzo Dee
7340d546b8 Honour base path from @WebAppConfiguration in @WebMvcTest
See gh-16485
2019-06-17 13:37:55 +01:00
Madhura Bhave
30cfe7b4c5 Polish 2019-06-13 08:02:26 -07:00
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
2019-06-12 16:34:31 -07:00
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
2019-06-12 13:49:39 -07:00
Phillip Webb
266d6334b2 Fix checkstyle RedundantModifier test violations 2019-06-07 20:46:33 -07:00
Andy Wilkinson
b18fffaf14 Move tests to JUnit 5 wherever possible 2019-06-07 12:25:54 +01:00
Andy Wilkinson
aef92b9295 Merge branch '2.1.x'
Closes gh-17079
2019-06-07 11:00:44 +01:00
Andy Wilkinson
24925c3dae Merge branch '2.0.x' into 2.1.x
Closes gh-17078
2019-06-07 10:50:34 +01:00
Andy Wilkinson
c6c139d980 Merge branch '1.5.x' into 2.0.x 2019-06-07 10:46:31 +01:00
Phillip Webb
db75347eb6 Merge branch '2.1.x' 2019-06-04 14:41:20 -07:00
Phillip Webb
0ef331018e Merge branch '2.0.x' into 2.1.x 2019-06-04 14:30:52 -07:00
Phillip Webb
7fc01971ed Merge branch '1.5.x' into 2.0.x 2019-06-04 14:20:25 -07:00
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
2019-05-31 22:35:36 -07:00
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
2019-05-31 22:29:20 -07:00
Madhura Bhave
898a903d2f Fix typos in javadoc 2019-05-31 15:18:29 -07:00
Andy Wilkinson
0644a79401 Repackage output capture and always use extension declaratively
Closes gh-17029
2019-05-31 18:33:10 +01:00
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
2019-05-30 23:44:35 -07:00
Phillip Webb
68aec8b6ee Polish 2019-05-30 11:30:27 -07:00
Andy Wilkinson
86380ab8db Add missing package-info.java files 2019-05-29 07:20:34 +01:00