Commit Graph

31264 Commits

Author SHA1 Message Date
Sébastien Deleuze
60978ff4c7 Polish WebRequest Javadoc
See gh-33698
2024-10-14 17:07:07 +02:00
rstoyanchev
cff6db02b4 Merge branch '6.1.x' 2024-10-14 16:00:48 +01:00
rstoyanchev
1a0b577bfc Do not support relative static resource paths
Closes gh-33687
2024-10-14 15:54:59 +01:00
rstoyanchev
3bfbe30a78 Normalize static resource path early
Rather than leaving it to the Resource implementation, and
potentially normalizing twice, we apply it once as part of the
initial processPath checks.

Closes gh-33689
2024-10-14 15:52:15 +01:00
Tran Ngoc Nhan
e191c34078 Polishing
Closes gh-33681
2024-10-14 16:44:42 +02:00
KimJuHyun
5bcce17fd9 Add tests for CollectionUtils
- findValueOfType
- findCommonElementType
- firstElement
- lastElement
- toArray
- compositeMap

Closes gh-33694
2024-10-14 16:10:05 +02:00
Brian Clozel
9be3d85a06 Merge branch '6.1.x' 2024-10-14 15:04:58 +02:00
Brian Clozel
32962894a0 Add runtime hints for JMS connection factories proxies
Prior to this commit, the JMS connection factories would proxy various
interfaces. This typically requires runtime hints for GraalVM native
applications and spring-jms is missing those.

This commit adds a new `ConnectionFactoriesRuntimeHints` that
contributes such hints with type conditions.

Fixes gh-33590
2024-10-14 14:54:24 +02:00
海子 Yang
3984266295 Remove unused method in UriComponentsBuilder
This commit removes HierarchicalUriComponents#checkSchemeAndHost
unused private method.

Closes gh-33684
2024-10-14 14:02:31 +02:00
Sébastien Deleuze
a75f22e548 Merge branch '6.1.x' 2024-10-14 12:09:00 +02:00
Hosam Aly
97bce6d361 Fix link in testing/support-jdbc.adoc
Fix the link to "Testing Data Access Logic with an Embedded Database".

Closes gh-33686
2024-10-14 12:07:17 +02:00
Simon Baslé
12134e8619 Merge branch '6.1.x' 2024-10-14 11:57:39 +02:00
Simon Baslé
8da31e1db7 Reject CORS request with 403 if Origin header is malformed
When assessing if a request is a CORS request, both mvc and reactive
`DefaultCorsProcessor` now catch `IllegalArgumentException` and turn
this into a 403 rejection rather than letting the exception propagate
into a 500 response.

Closes gh-33688
2024-10-14 11:50:19 +02:00
Sangmin Park
ae32227b50 Polish ServletWebRequest
Closes gh-33698
2024-10-14 11:38:24 +02:00
Sam Brannen
b3cc9a219e Ensure that @⁠MockitoBeanSettings is inherited in @⁠Nested test class
Closes gh-33685
2024-10-11 17:20:53 +02:00
Juergen Hoeller
7ea0ac55cd Restore special instance supplier generation for inner classes
Closes gh-33683
2024-10-11 16:59:15 +02:00
Juergen Hoeller
b748cb38c5 Rename to Mockito(Spy)BeanForFactoryBeanIntegrationTests 2024-10-11 16:58:18 +02:00
Sam Brannen
eb4bf1c0a6 Support @⁠MockitoBean reset and MockitoSession management with @⁠Nested tests
Prior to this commit, the MockitoResetTestExecutionListener failed to
reset mocks created via @⁠MockitoBean if the @⁠MockitoBean field was
declared in an enclosing class for a @⁠Nested test class. In addition,
the MockitoSession was not properly managed by the
MockitoTestExecutionListener.

This commit addresses those issue as follows.

1) The hasMockitoAnnotations() utility method has been overhauled so
that it finds Mockito annotations not only on the current test class
and on fields of the current test class but also on interfaces,
superclasses, and enclosing classes for @⁠Nested test classes as well
as on fields of superclasses and enclosing classes.

That allows the MockitoResetTestExecutionListener to properly detect
that it needs to reset mocks for fields declared in enclosing classes
for @⁠Nested classes.

2) MockitoTestExecutionListener has been revised so that it only
initializes a MockitoSession before each test method and closes the
MockitoSession after each test method. In addition, it now only manages
the MockitoSession when hasMockitoAnnotations() returns true for the
current test class (which may be a @⁠Nested test class). Furthermore,
it no longer attempts to initialize a MockitoSession during the
prepareTestInstance() callback since that results in an
UnfinishedMockingSessionException for a @⁠Nested test class due to the
fact that a MockitoSession was already created for the current thread
for the enclosing test class.

Closes gh-33676
2024-10-11 16:14:42 +02:00
Sam Brannen
7fb6a2e4f7 Polish Javadoc for Bean Override TestExecutionListeners 2024-10-11 15:50:56 +02:00
Sam Brannen
e2d981e809 Extract common logic into AbstractMockitoTestExecutionListener 2024-10-11 10:15:49 +02:00
Simon Baslé
0f25c75b9e Document TestExecutionListener implementations introduced in 6.2
Closes gh-33661
2024-10-10 16:32:38 +02:00
Sam Brannen
0e8316e704 Add value attribute alias to @⁠MockitoBean and @⁠MockitoSpyBean
This commit improves the user experience for common use cases by
introducing new `value` attributes in @⁠MockitoBean and
@⁠MockitoSpyBean that are aliases for the existing `name` attributes.

For example, this allows developers to declare
@⁠MockitoBean("userService") instead of @⁠MockitoBean(name =
"userService"), analogous to the existing name/value alias support in
@⁠TestBean.

Closes gh-33680
2024-10-10 13:05:39 +02:00
Sam Brannen
1b8f2c46c1 Update Javadoc for @⁠Mockito[Spy]Bean to reflect current semantics 2024-10-10 12:19:36 +02:00
Sam Brannen
f7e32a9c78 Revise singleton destruction for Bean Overrides
See gh-33678
2024-10-10 12:13:44 +02:00
Sam Brannen
8d652e9c12 Reinstate Bean Override support for replacing a manually registered singleton
Closes gh-33678
2024-10-09 18:10:07 +02:00
Sam Brannen
c70a6d3be1 Fix test method names 2024-10-09 17:17:57 +02:00
Sam Brannen
1afcb22205 Change enforceOverride flag to false in @⁠TestBean and @⁠MockitoBean
Based on feedback from the Spring Boot team, we have decided to change
the default values for the enforceOverride flags in @⁠TestBean and
@⁠MockitoBean from true to false.

Closes gh-33613
2024-10-09 17:08:58 +02:00
Sam Brannen
381b16fba2 Simplify Bean Override field injection logic
This commit simplifies the field injection logic for Bean Overrides in
order to align with the semantics of the core container and the Spring
TestContext Framework.

Closes gh-33677
2024-10-09 15:43:32 +02:00
Sam Brannen
4758424f6c Clean up warnings in Gradle build 2024-10-09 15:43:32 +02:00
Sam Brannen
7c3624318b Polish Mockito TestExecutionListeners 2024-10-09 15:43:32 +02:00
Sam Brannen
461f1724b7 Colocate nonexistent bean definition processing for Bean Overrides 2024-10-09 15:43:32 +02:00
Sam Brannen
b5c82b8dcb Reject bean names with factory prefix for Bean Overrides
Closes gh-33674
2024-10-09 15:43:32 +02:00
Sam Brannen
c864afd6fe Polishing 2024-10-09 15:43:32 +02:00
Stéphane Nicoll
f54fabad8f Merge pull request #33669 from Seungpang
* pr/33669:
  Polish "Reject empty strings in DurationFormatterUtils"
  Reject empty strings in DurationFormatterUtils

Closes gh-33669
2024-10-09 15:27:59 +02:00
Stéphane Nicoll
e2238c0211 Polish "Reject empty strings in DurationFormatterUtils"
See gh-33669
2024-10-09 15:26:09 +02:00
Seungrae
02c990ca82 Reject empty strings in DurationFormatterUtils
See gh-33669
2024-10-09 15:20:11 +02:00
Stéphane Nicoll
7f7f65cfcb Merge branch '6.1.x' 2024-10-09 14:44:38 +02:00
Stéphane Nicoll
f991c19b30 Merge pull request #33617 from asibross
* pr/33617:
  Polish "Adapt Javadoc note about log level of BeanPostProcessorChecker"
  Adapt Javadoc note about log level of BeanPostProcessorChecker

Closes gh-33617
2024-10-09 14:44:32 +02:00
Stéphane Nicoll
3c80d4c978 Polish "Adapt Javadoc note about log level of BeanPostProcessorChecker"
See gh-33617
2024-10-09 14:42:36 +02:00
Asi Bross
6da32b4631 Adapt Javadoc note about log level of BeanPostProcessorChecker
See gh-33617
2024-10-09 14:40:49 +02:00
rstoyanchev
8520fa5e2a Reduce warnings in WhatWgUrlParser 2024-10-09 13:29:49 +01:00
rstoyanchev
f4967f202e Revise URI template handling in WhatWgUrlParser
Closes gh-33673
2024-10-09 13:29:49 +01:00
rstoyanchev
1f4743af54 Lenient handling of malformed query in ServletServerHttpRequest
Closes gh-30489
2024-10-09 13:29:49 +01:00
Stéphane Nicoll
af85d1997b Merge branch '6.1.x' 2024-10-09 14:25:26 +02:00
Stéphane Nicoll
6677d452e7 Start building against Micrometer 1.14.0-RC1 snapshots
See gh-33648
2024-10-09 14:19:35 +02:00
Stéphane Nicoll
91cadf7f24 Start building against Reactor 2023.0.11 snapshots
See gh-33637
2024-10-09 14:16:14 +02:00
Stéphane Nicoll
90637b6344 Start building against Micrometer 1.12.11 snapshots
See gh-33647
2024-10-09 14:15:22 +02:00
Simon Baslé
ef77b4064f Keep DefaultServerHttpRequestBuilder-mutated headers case-insensitive
This change avoids the trap of creating a copy of `HttpHeaders` using a
case-sensitive `MultiValueMap` by mistake. Since mutability is always
desirable, we make a mutable copy by using `addAll` on an empty
`HttpHeaders`.

We can't simply rely on HttpHeaders' map-based constructor to detect
read-only header in this particular case, because the container's
original headers representation might in some cases be read-only.

Closes gh-33666
2024-10-09 11:39:33 +02:00
Sam Brannen
59ef5e140f Update warning for use of convention-based annotation attribute overrides
See gh-28761
2024-10-09 10:03:22 +02:00
Sam Brannen
e1c450d253 Support Bean Overrides with AOT and native image
This set of commits introduces AOT and native image support for the new
Bean Override feature in the Spring TestContext Framework -- for
example, for using @⁠TestBean and @⁠MockitoBean in AOT mode on the JVM
as well as in a GraalVM native image.

Note, however, that @⁠MockitoBean has currently only been tested in a
native image when mocking interfaces and using Mockito's
ProxyMockMaker, along with a custom runtime hints.

Closes gh-32933
2024-10-08 17:57:21 +02:00