Commit Graph

87 Commits

Author SHA1 Message Date
Rossen Stoyanchev 0eeb6717e0 Fix exception mock request builder
Issue: SPR-11043
2013-11-05 10:59:05 -05:00
Brian Clozel efa86e80d8 Upgrade json-path to 0.9.0 version
This version fixed bugs and improved performance.
New features: "select multiple attributes" and
"Array operations and slicing improved" (a new example
has been added in tests to reflect that).

See https://github.com/jayway/JsonPath/blob/master/README

Issue: SPR-10990
2013-10-18 15:10:15 -04:00
Rossen Stoyanchev c9bb0594f3 Polish
Issue: SPR-10789
2013-10-08 15:57:59 -04:00
Brian Clozel e04a756968 Support AntPathMatch URLs in URL ResultMatchers
Prior to this commit, one could only match exact URLs in redirectedUrl
and forwardedUrl ResultMatchers. When creating a resource with
a REST service, URLs often contain the id the new resource,
like "/resource/12".

This commit updates those ResultMatchers to support both
exact matches and AntPath matches, using new methods.
The former URL then can be tested against "/resource/*" in MVC tests.

Issue: SPR-10789
2013-10-08 10:54:15 +02:00
Brian Clozel 4bf5a0234c Add doesNotExist match to HeaderResultMatchers
Prior to this commit, one could not test for the absence of
a specific HTTP header in a response.
Using header("X-Custom-Header", Matchers.nullValue()) would not
work because it tests for an empty value of an existing header.

This commit adds a doesNotExist method on the
HeaderResultMatcher.

Issue: SPR-10771
2013-10-07 14:50:17 -04:00
Rossen Stoyanchev ed9b2966c0 Revise use of FilterChain in MockMvc
MockFilterChain should not be re-used across requests. This is not an
issue unless tests are executed concurrently. This change ensures the
MockFilterChain is re-created for each request in MockMvc.

Issue: SPR-10838
2013-08-27 11:48:03 -04:00
Rossen Stoyanchev 64baef9f19 Fix failing tests
Issue: SPR-10825
2013-08-22 20:56:50 -04:00
Rossen Stoyanchev ccaa101252 Fix typo 2013-08-22 16:09:32 -04:00
Rossen Stoyanchev c211c98b40 Support placeholder values in Spring MVC Test
Issue: SPR-10825
2013-08-22 16:05:44 -04:00
Deline Neo 909577082d Add attributeDoesNotExist ModelResultMatcher
Issue: SPR-10509
2013-07-30 15:35:23 -04:00
Rossen Stoyanchev 7bab879623 Fix issue with xpath assertions in Spring Test MVC
Issue: SPR-10704
2013-07-18 21:20:01 -04:00
Rossen Stoyanchev 2a15b5a895 Enable asyncSupported flag in Spring Test MVC
Also remove Servlet 3 bridge classes no longer needed since Spring
Framework 4 compiles with the Servlet 3 API. That means applications
may need to run tests with the Servlet 3 API jar although
technically they don't have to run with that in production.
2013-07-18 17:06:50 -04:00
Rossen Stoyanchev 9bc4663ead Add accept(String) method to mock request builder
Issue: SPR-10390
2013-06-20 20:57:24 -04:00
Sam Brannen d5a5a4894f Add header name to ex. msg in HeaderResultMatchers
Prior to this commit, the longValue() in HeaderResultMatchers added the
expected response header name to generated assertion failure messages;
however, both string() methods did not. This made it more difficult to
analyze the cause of failed tests.

Furthermore, while investigating a solution for this issue it became
apparent that longValue() throws a NullPointerException if the response
does not contain the specified header.

This commit addresses these issues as follows:

 - All methods in HeaderResultMatchers now include the response header
   name in generated assertion failure messages.

 - HeaderResultMatchers.longValue() now avoids NullPointerExceptions by
   explicitly asserting that the response contains the specified header.

 - The unit tests in HeaderAssertionTests have been expanded to test
   most foreseeable use cases.

Issue: SPR-10659
2013-06-17 17:59:24 +02:00
Rob Winch 9468548116 Add @Override to remaining source files
Issue: SPR-10130
2013-05-13 17:04:56 -05:00
Juergen Hoeller 2a44228b98 Consistent use of <pre class="code">
Issue: SPR-8108
2013-05-07 21:31:26 +02:00
Juergen Hoeller 527776cde4 Removed JDK 8 workaround (not necessary anymore with build 88) 2013-05-07 18:11:53 +02:00
Juergen Hoeller f91be88f8c Temporary workaround for JDK 8 test compilation/execution problem
Issue: SPR-9639
2013-04-23 14:03:03 +02:00
Juergen Hoeller 19f783bdd7 Fixed general test suite problems found during OpenJDK 8 upgrade
Issue: SPR-9639
2013-04-23 13:54:19 +02:00
Juergen Hoeller cf93d38c56 Added "destroyBean(Object)" method to AutowireCapableBeanFactory
Driven by the need for implementing Bean Validation 1.1's "releaseInstance" method in SpringConstraintValidatorFactory, as a direct counterpart to the use of AutowireCapableBeanFactory's "createBean(Class)" in "getInstance".

Issue: SPR-8199
2013-03-28 22:22:42 +01:00
Juergen Hoeller deba32cad9 Upgraded all Servlet API mocks to Servlet 3.0 (with a little bit of Servlet 3.1 support in MockHttpServletResponse) 2013-03-20 17:19:34 +01:00
Rossen Stoyanchev 3654a620fb Disable AsyncTests in spring-test-mvc 2013-03-10 10:00:01 -04:00
Rossen Stoyanchev eefd1c4ca6 Add context hierarchy tests to Spring MVC Test
Issue: SPR-5613
2013-03-07 11:20:19 -05:00
Phillip Webb 05765d7520 Replace EasyMock with Mockito
Issue: SPR-10126
2013-03-06 11:06:15 -08:00
Wesley Hall fbac428e23 Fix DefaultMockMvcBuilder fluent API generic type
Changed upper bound of generic parameter for DefaultMockMvcBuilder from
MockMvcBuilder to DefaultMockMvcBuilder to allow for ongoing method
chaining in the fluent API style.

Issue: SPR-10277
2013-03-01 16:30:02 -05:00
Rossen Stoyanchev eda53ec1d8 Allow merge of MockMultipart- w/ Mock- request builder
Issue: SPR-10280
2013-02-15 09:43:08 -05:00
Rossen Stoyanchev b47d97c23a Improve error message for JSON path expressions
Issue: SPR-SPR-10275
2013-02-15 09:43:08 -05:00
Arnaud Cogoluègnes ccca82be1b Make StandaloneMockMvcBuilder interface consistent
The exception resolvers can now be set using a setter that expects
varargs, just like other infrastructure beans.

Issue: SPR-10279
2013-02-15 09:43:08 -05:00
Phillip Webb d89e30b864 Fix unnecessary @SupressWarnings annotations 2013-01-29 15:37:25 -08:00
Sam Brannen 33ee0ea4a6 Fix broken test in ContentAssertionTests 2013-01-15 11:56:27 +01:00
Rossen Stoyanchev b2d6596901 Add contentTypeCompatibleWith option to Spring MVC Test
An expectation such as content().contentType(MediaType.TEXT_PLAIN)
fails if the actual media type contains a charset or another parameter.
A new method allows comparing the media type and subtype only via
content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN).

Issue: SPR-10165
2013-01-14 22:00:55 -05:00
Chris Beams bfdc191035 Merge branch 'SPR-10093' into 3.2.x
* SPR-10093:
  Polish changes from pull request #205
2013-01-11 16:35:08 +01:00
Chris Beams 74137794da Polish changes from pull request #205
- Replace space intendation with tabs
 - Remove leading tabs on otherwise empty lines
 - Remove illegal {@link ...} syntax in Javadoc @see reference

Issue: SPR-10093
2013-01-11 16:32:52 +01:00
Sam Brannen 18bf860c27 Update Javadoc for MockMvc
Deleted reference to the obsolete configureWarRootDir() method from the
stand-alone spring-test-mvc project.
2013-01-11 00:31:37 +01:00
Chris Beams 0829cbfdd3 Update license header for recently modified files
Issue: SPR-7763, SPR-10140, SPR-10132, SPR-10093, SPR-10103
2013-01-08 16:23:46 +01:00
Arnaud Cogoluègnes a56d8f28fe Add support for HTTP OPTIONS in Spring MVC Test
Issue: SPR-10093
2013-01-08 10:01:51 -05:00
Chris Beams 4c8cd7b0bd Add @Override annotations to test sources
Issue: SPR-10129
2012-12-28 23:05:44 +01:00
Chris Beams 4d97ff2479 Fix [dep-ann] warnings with @Deprecated 2012-12-28 22:50:45 +01:00
Phillip Webb 6c14eaad61 Fix [cast] compiler warnings 2012-12-28 22:41:06 +01:00
Phillip Webb 2cf45bad86 Replace space indentation with tabs
Issue: SPR-10127
2012-12-28 20:49:56 +01:00
Phillip Webb 1762157ad1 Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
    xargs perl -p -i -e "s/[ \t]*$//g" {} \;

Issue: SPR-10127
2012-12-28 20:49:45 +01:00
Craig Walls ccb1153440 Fix JavaDoc in MockRestServiceServer 2012-12-14 10:07:50 -05:00
Chris Beams f26534700a Eliminate all Javadoc warnings
- Support external Javadoc links using Gradle's javadoc.options.links

 - Fix all other Javadoc warnings, such as typos, references to
   non-existent (or no longer existent) types and members, etc,
   including changes related to the Quartz 2.0 upgrade (SPR-8275) and
   adding the HTTP PATCH method (SPR-7985).

 - Suppress all output for project-level `javadoc` tasks in order to
   hide false-negative warnings about cross-module @see and @link
   references (e.g. spring-core having a @see reference to spring-web).
   Use the `--info` (-i) flag to gradle at any time to see project-level
   javadoc warnings without running the entire `api` task. e.g.
   `gradle :spring-core:javadoc -i`

 - Favor root project level `api` task for detection of legitimate
   Javadoc warnings. There are now zero Javadoc warnings across the
   entirety of spring-framework. Goal: keep it that way.

 - Remove all @link and @see references to types and members that exist
   only in Servlet <= 2.5 and Hibernate <= 4.0, favoring 3.0+ and 4.0+
   respectively. This is necessary because only one version of each of
   these dependencies can be present on the global `api` javadoc task's
   classpath. To that end, the `api` task classpath has now been
   customized to ensure that the Servlet 3 API and Hibernate Core 4 jars
   have precedence.

 - SPR-8896 replaced our dependency on aspectjrt with a dependency on
   aspectjweaver, which is fine from a POM point of view, but causes
   a spurious warning to be emitted from the ant iajc task that it
   "cannot find aspectjrt on the classpath" - even though aspectjweaver
   is perfectly sufficient. In the name of keeping the console quiet, a
   new `rt` configuration has been added, and aspectjrt added as a
   dependency to it. In turn, configurations.rt.asPath is appended to
   the iajc classpath during both compileJava and compileTestJava for
   spring-aspects.

Issue: SPR-10078, SPR-8275, SPR-7985, SPR-8896
2012-12-12 12:55:10 +01:00
Phillip Webb c8a3562933 Update test tiles.xml files to use v3 DTD
Update tiles.xml files used with tests to reference tiles-config_3_0
instead of tiles-config_2_1 DTD.

Prior to this commit tiles based tests would fail when building
offline or behind a proxy server.
2012-12-10 15:39:47 -08:00
Phillip Webb 87f7ecf907 Refactor merge-artifacts script to a plugin
Refactor the existing merge-artifacts script to a full Gradle plugin.
The new plugin uses a 'merge' extension in favor of Gradle 'ext'
configuration and can be applied to all projects in a multi-module
build.

Any project that defines a 'merge.into' project will now implicitly
receive a dependency to that project. Furthermore other projects
with a dependency on 'merge.into' will receive a direct project
link within the IDE. For example: 'spring-webmvc-tiles3'
is merged into 'spring-webmvc' and 'spring-test-mvc' depends
on 'spring-webmvc'. Within the IDE 'spring-test-mvc' will show
dependencies to both 'spring-webmvc' and 'spring-webmvc-tiles'.

Issue: SPR-10042
2012-12-09 21:33:35 -08:00
Phillip Webb 90cfdbb040 Polish quote styles in gradle files
Replace singe quote-marks with double quote-marks when possible for a
more consistent style.
2012-12-09 21:32:27 -08:00
Phillip Webb a268528726 Polish .gradle file formatting to use tabs
Replace spaces with tabs for consistency with Java source code
2012-12-09 21:32:27 -08:00
Sam Brannen a436a57503 Move tests to spring-test module
When Spr9799XmlConfigTests and Spr9799AnnotationConfigTests were
created, there were issues with the classpath related to slf4j
dependencies that made it impossible for these classes to reside in the
spring-test module. Consequently, these tests were added to the
spring-test-mvc module. However, the issues with slf4j have since been
resolved in the Gradle build, and this commit therefore moves these test
classes to the spring-test module where they belong.

Issue: SPR-9799
2012-12-08 14:26:47 +01:00
Rossen Stoyanchev 3643d92cb8 Fix issue with creating ServletRequestAttributes
Prevously the FrameworkServlet created a new ServletRequestAttributes
instance for every request, unless the RequestContextHolder already
contained an instance whose type is not ServletRequestAttributes.
The main intent was that if RequestContextHolder contains a
PortletRequestAttributes, it should be left in place.

This change does an "instanceof" check against the request in
RequestContextHolder instead of an "equals" check on the type.
It still leaves PortletRequestAttributes in place but also allows
the previous request to be any sub-class of ServletRequestAttributes.

Issue: SPR-10025
2012-12-07 15:19:38 -05:00
Sam Brannen 69ace01640 Clean up warnings in spring-test
- Deleted unused imports.

 - Switched from junit.framework.Assert to org.junit.Assert, since the
   former is deprecated as of JUnit 4.11.

 - Suppressed warnings for continued deprecated usage of
   junit.framework.Assert.
2012-12-07 12:26:27 +01:00