Previously, when a project's jar was an input into a test task, a
cache hit required the current build to be using the same JDK as the
one that created the cache entry. This was due to the Created-By
entry in the jar's manifest which will vary if JDKs with different
values for the java.version and java.specification.vendor version are
used.
This commit configures normalization of the runtime classpath to ignore
META-INF/MANIFEST.MF, thereby allowing a cache hit when the tests were
previously run on a different JDK than the one being used now. Typically
this is a different update release being used on a CI agent and a
developer's machine. This change will therefore improve the likelihood
of a cache hit once remote caching has been enabled.
Closes gh-23872
Update `AnnotationTypeMappings` so that a custom `RepeatableContainers`
instances can be used. Prior to this commit, only standard repeatables
were used when reading the annotations. This works in most situations,
but causes regressions for some `AnnotationUtils` methods.
Fixed gh-23856
Prior to this commit, several of the methods in XpathRequestMatchers
declared unused type parameters (e.g., <T>). This was obviously the
result of copying an existing method that actually needs the type
parameter for proper casting.
For example, the following ...
public <T> RequestMatcher exists() {
// ...
}
... should actually be declared without <T>, since T is not used in the
implementation or in the return type:
public RequestMatcher exists() {
// ...
}
This commit removes all unused type parameter declarations in
XpathRequestMatchers.
Side Effects:
Now that we have removed the unused type parameter declarations, users
will see the following side effects if they had previously declared a
type argument when invoking such methods.
- Java: an "Unused type arguments for the non generic method ..."
warning will be generated by the compiler, but the code will continue
to work unmodified.
- Kotlin: a "Type inference failed: Not enough information to infer
parameter T in fun ..." compiler error will be raised, causing the
code to no longer compile (see
https://youtrack.jetbrains.com/issue/KT-5464). Removal of the type
argument declaration will allow the code to work correctly again.
Closes gh-23860
Prior to this commit, several of the ResultMatcher methods used in
MockMvc declared unused type parameters (e.g., <T>). This was obviously
the result of copying an existing method that actually needs the type
parameter for proper casting.
For example, the following in RequestResultMatchers ...
public <T> ResultMatcher attribute(String name, Object expectedValue) {
// ...
}
... should actually be declared without <T>, since T is not used in the
implementation or in the return type:
public ResultMatcher attribute(String name, Object expectedValue) {
// ...
}
This commit removes all unused type parameter declarations in MockMvc
result matchers.
Side Effects:
Now that we have removed the unused type parameter declarations, users
will see the following side effects if they had previously declared a
type argument when invoking such methods.
- Java: an "Unused type arguments for the non generic method ..."
warning will be generated by the compiler, but the code will continue
to work unmodified.
- Kotlin: a "Type inference failed: Not enough information to infer
parameter T in fun ..." compiler error will be raised, causing the
code to no longer compile (see
https://youtrack.jetbrains.com/issue/KT-5464). Removal of the type
argument declaration will allow the code to work correctly again.
Closes gh-23858
The new sessionAttributeDoesNotExist() method introduced in commit
e73344fc71 declares an unused type
parameter <T>.
This commit removes that unused type parameter from the method
signature.
See gh-23756
Analogous to the attributeDoesNotExist() method in ModelResultMatchers,
this commit introduces a new sessionAttributeDoesNotExist() method in
RequestResultMatchers which asserts that the given attributes are null
in the HttpSession.
Closes gh-23756
Update `TypeMappedAnnotation` mirror resolution logic so that mapped
annotation values are also considered. Prior to this commit, mirrors
in more complex meta-annotation scenarios would not resolve correctly.
Specifically, given the following:
@interface TestAliased {
@AliasFor(attribute = "qualifier")
String value() default "";
@AliasFor(attribute = "value")
String qualifier() default "";
}
@TestAliased@interface TestMetaAliased {
@AliasFor(annotation = Aliased.class, attribute = "value")
String value() default "";
}
@TestMetaAliased("test")
@interface TestComposed {
}
A merged `@TestAliased` annotation obtained from a `@TestComposed`
root annotation would return a `value` and `qualifier` of "".
This was because the "value" and "qualifier" mirrors needed to be
resolved against the `@TestMetaAliased` meta-annotation. They cannot be
resolved against the declared `@TestComposed` annotation because it
does not have any attributes. Our previous tests only covered a single
depth scenario where `@TestMetaAliased` was used directly on the
annotated element.
Closes gh-23767
Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
This commit is necessary in order to upgrade the Gradle wrapper, since
the recent attempt to do so ended up in a corrupted JAR file for the
Gradle wrapper.
Spring Framework 5.2 introduced an EventPublishingTestExecutionListener
in the Spring TestContext Framework. This listener is automatically
registered via the spring.factories mechanism; however, this listener is
not registered in the abstract JUnit 4 and TestNG base classes.
This commit addresses this oversight by explicitly registering the
EventPublishingTestExecutionListener in the following classes.
- AbstractJUnit4SpringContextTests
- AbstractTransactionalJUnit4SpringContextTests
- AbstractTestNGSpringContextTests
- AbstractTransactionalTestNGSpringContextTests
Closes gh-23748