1. 15 8月, 2015 4 次提交
    • S
      Rename test classes to avoid confusion · e7c95add
      Sam Brannen 提交于
      e7c95add
    • S
      Polishing · d4d5e5ce
      Sam Brannen 提交于
      d4d5e5ce
    • S
      Differentiate b/t (in)definite results in JsonPath assertions · 07bb0378
      Sam Brannen 提交于
      Prior to this commit, the exists() method in JsonPathExpectationsHelper
      correctly asserted that the evaluated JsonPath expression resulted in a
      value (i.e., that a non-null value exists); however, if the value was
      an empty array, the exists() method always threw an AssertionError.
      
      The existing behavior makes sense if the JsonPath expression is
      'indefinite' -- for example, if the expression uses a filter to select
      results based on a predicate for which there is no match in the JSON
      document, but the existing behavior is illogical and therefore invalid
      if the JsonPath expression is 'definite' (i.e., directly references an
      array in the JSON document that exists but happens to be empty). For
      example, prior to this commit, the following threw an AssertionError.
      
          new JsonPathExpectationsHelper("$.arr").exists("{ 'arr': [] }");
      
      Similar arguments can be made for the doesNotExist() method.
      
      After thorough analysis of the status quo, it has become apparent that
      the existing specialized treatment of arrays is a result of the fact
      that the JsonPath library always returns an empty list if the path is
      an 'indefinite' path that does not evaluate to a specific result.
      Consult the discussion on "What is Returned When?" in the JsonPath
      documentation for details:
      
          https://github.com/jayway/JsonPath#what-is-returned-when
      
      This commit addresses these issues by ensuring that empty arrays are
      considered existent if the JsonPath expression is definite but
      nonexistent if the expression is indefinite.
      
      Issue: SPR-13351
      07bb0378
    • S
      Polish assertion msgs in JsonPathExpectationsHelper · d2503340
      Sam Brannen 提交于
      d2503340
  2. 14 8月, 2015 5 次提交
  3. 13 8月, 2015 1 次提交
  4. 12 8月, 2015 1 次提交
  5. 08 8月, 2015 1 次提交
  6. 07 8月, 2015 2 次提交
    • S
      Return null instead of empty cookies array in Spring MVC Test · 93c07e76
      Sam Brannen 提交于
      Prior to this commit, MockHttpServletRequestBuilder always supplied an
      array of cookies to the MockHttpServletRequest that it built, even if
      the array was empty.
      
      However, this violates the contract of HttpServletRequest. According to
      the Servlet API, the getCookies() method "returns null if no cookies
      were sent."
      
      This commit ensures that MockHttpServletRequestBuilder no longer
      configures an empty array of cookies in the mock request that it builds.
      
      Issue: SPR-13314
      93c07e76
    • C
      Introduce additional JsonPath matchers in Spring MVC Test · fffdd1e9
      Craig Andrews 提交于
      This commit introduces the following methods in JsonPathResultMatchers
      in the Spring MVC Test framework.
      
      - isString()
      - isBoolean()
      - isNumber()
      - isMap()
      
      In addition, this commit overhauls the Javadoc in
      JsonPathResultMatchers and JsonPathExpectationsHelper.
      
      Issue: SPR-13320
      fffdd1e9
  7. 29 7月, 2015 2 次提交
    • S
      Introduce 'value' alias for 'attribute' in @AliasFor · 72529208
      Sam Brannen 提交于
      SPR-11512 introduced support for annotation attribute aliases via
      @AliasFor, requiring the explicit declaration of the 'attribute'
      attribute. However, for aliases within an annotation, this explicit
      declaration is unnecessary.
      
      This commit improves the readability of alias pairs declared within an
      annotation by introducing a 'value' attribute in @AliasFor that is an
      alias for the existing 'attribute' attribute. This allows annotations
      such as @ContextConfiguration from the spring-test module to declare
      aliases as follows.
      
      public @interface ContextConfiguration {
      
           @AliasFor("locations")
           String[] value() default {};
      
           @AliasFor("value")
           String[] locations() default {};
      
          // ...
      }
      
      Issue: SPR-13289
      72529208
    • S
      Fix references and typos in Spring MVC Test Javadoc · 6a59d005
      Sam Brannen 提交于
      This commit fixes numerous references to 'legacy' packages within the
      Javadoc for the Spring MVC Test framework.
      
      In addition, this commit improves examples in Javadoc, adds links to
      related classes where appropriate, and removes unnecessary imports for
      types that are only referenced within documentation.
      
      Issue: SPR-13284
      6a59d005
  8. 28 7月, 2015 5 次提交
    • S
      Polish · 29e6272c
      Sam Brannen 提交于
      29e6272c
    • S
      Redesign MockMvcHtmlUnitDriverBuilder API · 9023cf6a
      Sam Brannen 提交于
      This commit introduces a dedicated build() method in
      MockMvcHtmlUnitDriverBuilder to replace createDriver(). In addition,
      the configureDriver() method has been renamed to withDelegate() and now
      returns the builder for further customization.
      
      This commit also overhauls the Javadoc for static factory methods and
      the class-level Javadoc in MockMvcHtmlUnitDriverBuilder for greater
      clarity to end users.
      
      Issues SPR-13158
      9023cf6a
    • S
      Redesign MockMvcWebClientBuilder API · 3b84a7e8
      Sam Brannen 提交于
      This commit introduces a dedicated build() method in
      MockMvcWebClientBuilder to replace createWebClient(). In addition, the
      configureWebClient() method has been renamed to withDelegate() and now
      returns the builder for further customization.
      
      This commit also overhauls the constructor and class-level Javadoc in
      MockMvcWebClientBuilder for greater clarity to end users.
      
      Issues SPR-13158
      3b84a7e8
    • S
      Polish Javadoc in HtmlUnit support · 3d6f4656
      Sam Brannen 提交于
      3d6f4656
    • S
      Rename configureWebClient() to modifyWebClientInternal() in HtmlUnit support · 680936f4
      Sam Brannen 提交于
      This commit renames the configureWebClient() method in
      WebConnectionHtmlUnitDriver to modifyWebClientInternal() in order to
      better convey the relationship to HtmlUnitDriver#modifyWebClient().
      
      Issues SPR-13158
      680936f4
  9. 27 7月, 2015 8 次提交
  10. 26 7月, 2015 5 次提交
    • S
      Deprecate TxConfigAttributes alongside @TxConfig · 47e1724d
      Sam Brannen 提交于
      Since @TransactionConfiguration is now deprecated, this commit also
      deprecates TransactionConfigurationAttributes with the intention of
      completely removing TransactionConfigurationAttributes once
      @TransactionConfiguration has been removed.
      
      Issue: SPR-13277
      47e1724d
    • S
      Introduce @Commit alias for @Rollback(false) · d6bdfcaa
      Sam Brannen 提交于
      Due to common usage of @Rollback(false), this commit introduces a new
      @Commit annotation that more clearly conveys the intent of the code
      while retaining the run-time semantics.
      
      @Commit is in fact meta-annotated with @Rollback(false).
      
      Issue: SPR-13279
      d6bdfcaa
    • S
      Polishing · baa66f7b
      Sam Brannen 提交于
      baa66f7b
    • S
      Migrate @TxConfig usage to @Rollback & @Transactional qualifiers · c4bbc9df
      Sam Brannen 提交于
      Issue: SPR-13276, SPR-13277
      c4bbc9df
    • S
      Support @Rollback on classes & deprecate @TxConfig · 3f8b5128
      Sam Brannen 提交于
      Since Spring Framework 2.5, @Rollback has been supported on test
      methods, with class-level rollback settings configured via
      @TransactionConfiguration; however, allowing @Rollback to be declared
      on test classes with method-level declarations overriding class-level
      declarations would prove more intuitive than having to declare both
      @TransactionConfiguration and @Rollback. Furthermore, the
      transactionManager flag in @TransactionConfiguration was made
      superfluous many years ago with the introduction of support for a
      qualifier in @Transactional.
      
      This commit enables @Rollback to be declared at the class level for
      default rollback semantics within test class hierarchies and deprecates
      @TransactionConfiguration in favor of @Rollback and @Transactional
      qualifiers.
      
      Issue: SPR-13276, SPR-13277
      3f8b5128
  11. 25 7月, 2015 1 次提交
  12. 24 7月, 2015 2 次提交
  13. 23 7月, 2015 2 次提交
    • S
      Polishing · 2afbfb2c
      Sam Brannen 提交于
      2afbfb2c
    • B
      Improve DateHeaders in MockServletRequest/Response · 43e36e2d
      Brian Clozel 提交于
      Prior to this change, calling the `setDateHeader` method on a
      Spring Test MockHttpServletResponse instance would just store the given
      long value in a Map, not writing it as a formatted date String.
      Also, calling `getDateHeader` on a MockHttpServletRequest would not
      support date strings and could not parse those values.
      
      This can be problematic when testing features related to date headers
      such as "Expires", "If-Modified-Since", "Last-Modified", etc.
      
      This commit adds formatting and parsing capabilities to Servlet Mocks
      for date strings in HTTP headers.
      
      When formatting dates to Strings, the date format used is the one
      preferred by the HTTP RFC. When parsing date Strings, multiple date
      formats are supported for better compatibility.
      
      Issue: SPR-11912
      43e36e2d
  14. 22 7月, 2015 1 次提交
    • S
      Do not reuse mock requests in Spring MVC Test · 3c799e6e
      Sam Brannen 提交于
      SPR-13211 introduced support for reusing mock requests in Spring MVC
      Test if the request was created by the the Spring TestContext
      Framework. Unfortunately, that change makes it impossible for
      MockMvc.perform() to be invoked multiple times within the same test
      method without side effects. For example, session attributes and
      request parameters are transparently and unexpectedly retained for
      subsequent invocations of perform(), causing certain categories of
      tests to fail.
      
      This commit reverts the changes introduced in SPR-13211 and introduces
      a new MockMvcReuseTests class to serve as regression tests within
      Spring's test suite.
      
      Issue: SPR-13260, SPR-13211
      3c799e6e