Commit Graph

218 Commits

Author SHA1 Message Date
Andy Wilkinson
7a4c18eaba Polish "Deprecate JsonContent.assertThat()"
Closes gh-9678
2017-07-27 10:50:09 +01:00
Priyanshi
fa57491030 Deprecate JsonContent.assertThat()
See gh-9678
2017-07-27 10:49:55 +01:00
Spring Buildmaster
17a5bb0be4 Next development version 2017-07-27 08:00:21 +00:00
Spring Buildmaster
41c5c0e7c9 Next development version 2017-07-26 08:30:55 +00:00
Andy Wilkinson
ece66e1d4a Polish javadoc in JsonContentAssert
See gh-9675
2017-07-21 15:30:09 +01:00
Andy Wilkinson
f6727e786a Polish "Fix JsonContentAssert type safety warnings"
- Format code
- Update an existing test to use the contains method that would
  previously have triggered a type safety warning

Closes gh-9675
2017-07-21 15:14:53 +01:00
Mihhail Lapushkin
ae91c8460f Fix JsonContentAssert type safety warnings
Previously, JsonContentAssert returns AbstractMapAssert from
extractingJsonPathMapValue. This could lead to type safety warnings
when calling one of the assert's methods with a generic varargs
parameter such as
contains(Entry<? extends Object, ? extends Object>...).

This commit replaces the use of both AbstractMapAssert and
AbstractListAssert with MapAssert and ListAssert respectively. These
classes use final methods and @SafeVargs args to prevent the
above-described problem from occurring.

See gh-9675
2017-07-21 15:10:57 +01:00
Spring Buildmaster
05d4d0281c Next Development Version 2017-06-08 12:47:16 +00:00
Andy Wilkinson
84721666c5 Stop DuplicateJsonObjectContextCustomizer breaking context caching
See gh-9248
2017-06-06 22:23:43 +01:00
Andy Wilkinson
21a5ab7875 Log a warning during tests when multiple JSONOjects on the class path
Closes gh-9248
2017-06-06 21:35:33 +01:00
Stephane Nicoll
b5709fd618 Polish
See gh-9330
2017-05-28 17:44:58 +02:00
Stephane Nicoll
a22b3d9515 Merge branch '1.4.x' into 1.5.x 2017-05-12 17:27:28 +02:00
Stevo Slavić
6e1d99aa10 Fix typo in javadoc
Closes gh-9212
2017-05-12 17:26:26 +02:00
Phillip Webb
931ce15d7f Update copyright header dates 2017-05-09 21:43:52 -07:00
Spring Buildmaster
9768b0a8c2 Next Development Version 2017-04-21 08:32:01 +00:00
Spring Buildmaster
d719d2cbbc Next Development Version 2017-04-20 12:46:19 +00:00
Phillip Webb
5abc050a96 Support detection and with test initializers
Relax `SpringBootTestContextBootstrapper` rules so that a test can
specify an `ApplicationContextInitializer` and still have
`@SpringBootConfiguration` detected.

Prior to this commit detection would not occur because it's possible
that an initializer _could_ register configuration. This scenario is
actually quite unlikely to occur, certainly less likely than wanting to
use an initializer in combination with auto-detection.

Fixes gh-8483
2017-04-19 22:18:12 -07:00
Phillip Webb
393c17b68b Support @SpringBootTest with @ContextHierarchy
Update SpringBootTestContextBootstrapper to detect `@ContextHierarchy`
annotations so that only the last child creates a
`WebApplicationContext`.

Prior to this commit a context hierarchy would start two embedded web
servers which is inconsistent with the `SpringApplicationBuilder`
behavior.

Fixes gh-8311
2017-04-18 14:56:12 -07:00
Phillip Webb
8eb79b3c0f Polish 2017-04-18 11:13:12 -07:00
Phillip Webb
f46d799f31 Polish 2017-04-17 22:08:51 -07:00
Madhura Bhave
9e2d54feae Support json view with JacksonTester
Closes gh-8672
2017-04-17 11:14:26 -07:00
Stephane Nicoll
c8ac94b75d Polish contribution
Closes gh-8490
2017-03-10 09:51:35 +01:00
Roland Weisleder
a6f0da8cc6 Introduce reset method to OutputCapture
Closes gh-8390
2017-03-10 09:48:36 +01:00
Spring Buildmaster
d23fa24340 Next Development Version 2017-03-03 16:18:26 +00:00
Spring Buildmaster
2a83e80a9b Next Development Version 2017-03-03 14:39:21 +00:00
Andy Wilkinson
545b29552d Merge branch '1.4.x' into 1.5.x 2017-02-28 15:58:08 +00:00
Andy Wilkinson
98cf35d48e Polish "Ignore spock.lang annotations when creating test context cache key"
See gh-8252
2017-02-28 15:55:55 +00:00
erlholmq
8f18df8a9c Ignore spock.lang annotations when creating test context cache key
See gh-7524
Closes gh-8252
2017-02-28 15:49:35 +00:00
Phillip Webb
ca1540cefe Update header copyright for changed files 2017-02-27 20:41:18 -08:00
Phillip Webb
5867cd6175 Polish 2017-02-27 20:41:18 -08:00
Andy Wilkinson
8318177b0d Merge branch '1.4.x' into 1.5.x 2017-02-21 20:20:26 +00:00
Andy Wilkinson
70e802fba5 Use name from @SpyBean to disambiguate multiple candidates
Previously, @SpyBean's name attribute was not used when determining
the name of the bean to spy upon. When there were multiple candidates,
none of which were primary, this would lead to a failure to find the
bean to spy upon. This behaviour is also inconsistent with @MockBean
which does use the name attribute to identify the bean to mock.

This commit updates MockitoPostProcessor to use the name attribute,
when set, to identify the bean that should be spied upon. For
consistency with @MockBean it is always used when set. When not set
the previous logic will continue to be used.

Closes gh-8315
2017-02-21 20:19:50 +00:00
Johnny Lim
0adab8a2be Use logical 'and' instead of bitwise 'and'
Closes gh-8198
2017-02-06 10:35:13 +01:00
Andy Wilkinson
b9b0cdb342 Merge branch '1.4.x' into 1.5.x 2017-02-02 13:48:19 +00:00
Andy Wilkinson
2f50d515a1 Apply root to URIs directly rather than relying on expansion
Previously, TestRestTemplate applied the root URI to URIs by
converting them to a String and then passing the String to the
RestTemplate delegate. Being a String, meant that the URI passed
through RestTemplate's standard URI template expansion processing
using the configured UriTemplateHandler. While this caused the root
URI to be applied, it also had the unwanted side-effect of
encoding the URI for a second time.

This commit updates TestRestTemplate so that, when configured with a
RootUriTemplateHandler, it applies the root URI directly and then
passes a modified URI to the RestTemplate delegate. Being a URI means
that no template expansion is performed and the possible double
encoding is avoided.

Closes gh-8163
2017-02-02 13:28:52 +00:00
Spring Buildmaster
5c12500366 Next Development Version 2017-01-30 20:10:13 +00:00
Spring Buildmaster
a2696bf873 Next Development Version 2017-01-30 11:40:24 +00:00
Andy Wilkinson
dd4051686b Remove empty test
The caching behaviour when using ImportAutoConfiguration is covered
by tests in spring-boot-test-auto-configuration, specifically by
ImportsContextCustomizerFactoryWithAutoConfigurationTests.

See gh-7953
2017-01-30 09:59:11 +00:00
Phillip Webb
fa6a138598 Refine ImportsContextCustomizer cache logic
Update `ImportsContextCustomizer` so that whenever possible a more
specific cache key is used.

Prior to this commit the customizer would generate a key based on *all*
annotations on the test class. This has repeatedly caused issues where
test classes that should have the same cache key did not due to
unrelated annotations.

A new `DeterminableImports` interface has been added that can be
implemented by `ImportSelector` and `ImportBeanDefinitionRegistrar`
implementations that are able to determine their imports early. The
existing `ImportAutoConfigurationImportSelector` and
`AutoConfigurationPackages` classes have been retrofitted with
this interface.

Fixes gh-7953
2017-01-27 17:19:52 -08:00
Spring Buildmaster
ed1ce140c0 Next Development Version 2017-01-26 14:20:39 +00:00
Stephane Nicoll
505e7f75ea Polish contribution
Closes gh-8089
2017-01-25 11:01:53 +01:00
dreis
d58f38f6f6 Use String.replace() with single char if possible
See gh-8089
2017-01-25 11:01:52 +01:00
Andy Wilkinson
b71baf2c38 Support @ContextHierarchy when using @SpringBootTest
Closes gh-8000
2017-01-20 16:24:42 +00:00
Andy Wilkinson
c31a2d8101 Merge branch '1.4.x' into 1.5.x 2017-01-19 11:03:33 +00:00
Andy Wilkinson
80a1e1ae64 Polishing 2017-01-19 11:03:18 +00:00
Andy Wilkinson
4e70cd2934 Merge branch '1.4.x' into 1.5.x 2017-01-19 10:58:34 +00:00
Andy Wilkinson
b7a02e7237 Update TestRestTemplate to apply template handler to URIs
Previously, TestRestTemplate would only apply the UriTemplateHandler
to Strings and not to URIs. When using the auto-configured
TestRestTemplate, this prevented relative URIs from being
made absolute using LocalHostUriTemplateHandler.

The commit updates TestRestTemplate to turn URIs into Strings before
passing them to the delegate RestTemplate. Turning them into Strings
ensures that the delegate calls the UriTemplateHandler.

Closes gh-7891
2017-01-19 10:39:02 +00:00
Andy Wilkinson
d2201d5284 Correct copyright dates and enforce that starting year is 2012
Closes gh-7923
2017-01-13 18:43:30 -05:00
Phillip Webb
0fca9aaccb Polish Mockito 2.0 support 2017-01-05 16:42:12 -08:00
Phillip Webb
abb8e3663a Polish Mockito 2.0 support 2017-01-05 16:28:59 -08:00