Commit Graph

209 Commits (e2bc24e3d7ba49a5b5cdc622e361d445ebacce62)

Author SHA1 Message Date
Phillip Webb a9e8116a99 Only check for Mockito once
Update `MockReset` so that checking for Mockito only happens once.

Closes gh-14260
6 years ago
Phillip Webb 9543fcf44d Upgrade to spring-javaformat 0.0.6 6 years ago
Phillip Webb 99dad81e9a Update copyright header year for changed files 7 years ago
Phillip Webb 0a0247975c Formatting 7 years ago
Phillip Webb 4e96587dc8 Polish modifier declaration ordering
Follow that Java language specification.
7 years ago
Phillip Webb 3ee777e142 Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the
the check.
7 years ago
Andy Wilkinson 06cf698387 Polish 7 years ago
Phillip Webb a8f366a554 Fix copyright header for edited files 7 years ago
Phillip Webb 798522d890 Format with Eclipse Oxygen SR2 7 years ago
Andy Wilkinson debe15b284 Polish 7 years ago
Andy Wilkinson aac88502c8 Reinject mocks when context is dirtied before each method
Closes gh-11903
7 years ago
Phillip Webb 8e783cdae9 Polish 7 years ago
Johnny Lim 97a51ddcaa Use the platform-specific line separator
See gh-11674
7 years ago
Phillip Webb 2c429ba77d Restore static final formatting
Restore static final constants to upper case formatting.

See gh-10457
7 years ago
Phillip Webb 6a55623910 Polish 7 years ago
Johnny Lim bfa291f671 Polish 7 years ago
Andy Wilkinson 663cae1255 Note behaviour of @MockBean and @SpyBean with non-bean dependencies
Closes gh-10381
7 years ago
Andy Wilkinson 7a4c18eaba Polish "Deprecate JsonContent.assertThat()"
Closes gh-9678
7 years ago
Priyanshi fa57491030 Deprecate JsonContent.assertThat()
See gh-9678
7 years ago
Andy Wilkinson ece66e1d4a Polish javadoc in JsonContentAssert
See gh-9675
7 years ago
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
7 years ago
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
7 years ago
Andy Wilkinson 84721666c5 Stop DuplicateJsonObjectContextCustomizer breaking context caching
See gh-9248
8 years ago
Andy Wilkinson 21a5ab7875 Log a warning during tests when multiple JSONOjects on the class path
Closes gh-9248
8 years ago
Stephane Nicoll b5709fd618 Polish
See gh-9330
8 years ago
Stephane Nicoll a22b3d9515 Merge branch '1.4.x' into 1.5.x 8 years ago
Stevo Slavić 6e1d99aa10 Fix typo in javadoc
Closes gh-9212
8 years ago
Phillip Webb 931ce15d7f Update copyright header dates 8 years ago
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
8 years ago
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
8 years ago
Phillip Webb 8eb79b3c0f Polish 8 years ago
Phillip Webb f46d799f31 Polish 8 years ago
Madhura Bhave 9e2d54feae Support json view with JacksonTester
Closes gh-8672
8 years ago
Stephane Nicoll c8ac94b75d Polish contribution
Closes gh-8490
8 years ago
Roland Weisleder a6f0da8cc6 Introduce reset method to OutputCapture
Closes gh-8390
8 years ago
Andy Wilkinson 545b29552d Merge branch '1.4.x' into 1.5.x 8 years ago
Andy Wilkinson 98cf35d48e Polish "Ignore spock.lang annotations when creating test context cache key"
See gh-8252
8 years ago
erlholmq 8f18df8a9c Ignore spock.lang annotations when creating test context cache key
See gh-7524
Closes gh-8252
8 years ago
Phillip Webb ca1540cefe Update header copyright for changed files 8 years ago
Phillip Webb 5867cd6175 Polish 8 years ago
Andy Wilkinson 8318177b0d Merge branch '1.4.x' into 1.5.x 8 years ago
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
8 years ago
Johnny Lim 0adab8a2be Use logical 'and' instead of bitwise 'and'
Closes gh-8198
8 years ago
Andy Wilkinson b9b0cdb342 Merge branch '1.4.x' into 1.5.x 8 years ago
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
8 years ago
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
8 years ago
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
8 years ago
Stephane Nicoll 505e7f75ea Polish contribution
Closes gh-8089
8 years ago
dreis d58f38f6f6 Use String.replace() with single char if possible
See gh-8089
8 years ago
Andy Wilkinson b71baf2c38 Support @ContextHierarchy when using @SpringBootTest
Closes gh-8000
8 years ago