Commit Graph

359 Commits

Author SHA1 Message Date
Phillip Webb 93f6168fd0 Polish 2017-09-28 07:54:22 -07:00
Stephane Nicoll 1403ff1b00 Add a way to run a test only with a certain Java version
Closes gh-9530
2017-09-28 14:05:26 +02:00
Phillip Webb 9e43b99966 Polish 2017-09-27 17:44:48 -07:00
dreis2211 f3472beed8 Remove redundant semicolons
Closes gh-10422
2017-09-26 08:38:43 +02:00
Andy Wilkinson f0693989f1 Polish 2017-09-23 07:02:59 +01:00
Eddú Meléndez 97aeaa4a32 Add Jsonb support
Spring Framework 5 will support Jsonb as a HttpMessageConverter, this
commit adds auto-configuration support. Also, support for Jsonb in the
@JsonTest has been added.

This implementation is running against Apache Johnzon

See gh-9648
2017-09-21 15:11:09 +02:00
Andy Wilkinson 7c1bc68fbe Consider JUnit Jupiter test classes in TestTypeExcludeFilter
Previously, TestTypeExcludeFilter only looked for JUnit 4 class
and method annotations when determining if a class was a test class.
As a result, if an application was using JUnit Jupiter, its test
classes would not be exluded during component scanning.

This commit expands TestTypeExcludeFilter to also identify classes
using JUnit Jupiter. This includes classes (meta-)annotated with
@ExtendWith and methods (meta-)annotated with @Testable. The later
provides detection of Jupiter's @Test, @TestFactory, and @RepeatedTest
annotations all of which are meta-annotated with @Testable.

Closes gh-6898
2017-09-21 11:19:41 +01:00
Andy Wilkinson 6e2dfc75f3 Drop support for Mockito 1.x
Closes gh-10247
2017-09-20 08:56:14 +01:00
Andy Wilkinson 09c64d52e1 Improve ApplicationContextRunner diagnostics when context start fails
Closes gh-10250
2017-09-19 09:14:33 +01:00
Stephane Nicoll 4670cc7795 Relax use of spring.session.store-type
This commit makes the "spring.session.store-type" property optional,
adding an additional check when it is not present that validates only
one supported implementation is available on the classpath.

As Spring Session has been modularized, the chance that multiple
implementations are available on the classpath are lower. When only
one implementation is present, we attempt to auto-configure it. When
more than one implementation is present and no session store is
configured, a NonUniqueSessionRepositoryException is thrown.

Closes gh-9863
2017-09-13 11:20:34 +02:00
Phillip Webb 2e51b48cd9 Refactor actuator package locations
Restructure actuator packages to improve structure. The following
changes have been made:

 - Separate actuator and actuator auto-configuration into different
   modules.
 - Move endpoint code into `spring-boot-actuator`.
 - Move `Endpoint` implementations from a single package into
   technology specific packages.
 - Move `HealthIndicator` implementations from a single package into
   technology specific packages.
 - As much as possible attempt to mirror the `spring-boot` package
   structure and class naming in `spring-boot-actuator` and
   `spring-boot-actuator-autoconfigure`.
 - Move `DataSourceBuilder` and DataSource meta-data support from
   `spring-boot-actuator` to `spring-boot`.

Fixes gh-10261
2017-09-12 00:11:20 -07:00
Johnny Lim 30262e3bc1 Polish
Closes gh-10168
2017-09-06 12:52:24 +02:00
Phillip Webb 2c97d3a5e9 Polish 2017-08-29 15:59:32 -07:00
Stephane Nicoll 2cbffc329f Remove import on Guava
Closes gh-10085
2017-08-28 09:05:02 +02:00
Johnny Lim 9dd7184b6e Remove SystemPropertiesHandler.properties
Closes gh-10080
2017-08-27 14:05:55 +02:00
Johnny Lim 4ae3691fee Avoid substring() invocation when the result is itself
Closes gh-10077
2017-08-25 17:37:56 +02:00
Stephane Nicoll 3cf0f65179 Remove regression tests for older Mockito versions
Closes gh-9904
2017-08-16 15:44:17 +02:00
Andy Wilkinson abf39915e8 Polish 2017-08-04 11:12:33 +01:00
Phillip Webb 9127c48fb5 Fixup warnings 2017-07-27 16:39:49 -07:00
Phillip Webb a869d25dbb Polish 2017-07-27 16:16:35 -07:00
Andy Wilkinson 003fbb6660 Merge branch '1.5.x' 2017-07-27 10:51:27 +01:00
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
Stephane Nicoll 579c6feb93 Polish 2017-07-27 11:10:12 +02:00
Stephane Nicoll eacb6b13f3 Fix compatibility with JUnit's ExpectedException
This commit ensures that an exception that is thrown as part of the
`ContextConsumer` callback is thrown as is.

Closes gh-9878
2017-07-27 11:08:01 +02:00
Spring Buildmaster 17a5bb0be4 Next development version 2017-07-27 08:00:21 +00:00
Phillip Webb 89ad0660d1 Make ApplicationContextRunner immutable
Update `ApplicationContextRunner` so that it is totally immutable.
Methods now return new instances rather than changing existing state.

See gh-9875
2017-07-26 17:50:34 -07:00
Phillip Webb ad9f28110c Make TestPropertyValues immutable
Update `TestPropertyValues` so that it is totally immutable. Methods
now return a new instance rather than changing existing state.

See gh-9875
2017-07-26 17:49:31 -07:00
Phillip Webb 07556cda51 Restructure `boot.test.context` package
Split up `org.springframework.boot.test.context` into distinct packages
for `runner` and `assertj`.

See gh-9875
2017-07-26 17:47:59 -07:00
Phillip Webb 497457c397 Rename ApplicationContextTester -> Runner
Rename `ApplicationContextTester` and related classes to
`ApplicationContextRunner` and refactor existing tests to use correctly
named variables.

See gh-9875
2017-07-26 17:46:06 -07:00
Andy Wilkinson 5616915621 Polishing 2017-07-26 17:40:29 +01:00
Spring Buildmaster 41c5c0e7c9 Next development version 2017-07-26 08:30:55 +00:00
Emanuel Campolo 2626a3a795 Use lambdas when possible
Replace anonymous inner classes with lambda declarations (when possible
using method references).

See gh-9781
2017-07-25 00:53:38 -07:00
Emanuel Campolo 04fdec6f8b Replace explicit generics with diamond operator
Where possible, explicit generic declarations to use the Java 8 diamond
operator.

See gh-9781
2017-07-25 00:53:37 -07:00
Phillip Webb 3a01f4a6da Polish lambda formatting 2017-07-24 13:18:33 -07:00
Johnny Lim bd27d147d7 Polish
Closes gh-9827
2017-07-21 15:38:00 +01:00
Andy Wilkinson 20577657ee Merge branch '1.5.x' 2017-07-21 15:30:35 +01:00
Andy Wilkinson ece66e1d4a Polish javadoc in JsonContentAssert
See gh-9675
2017-07-21 15:30:09 +01:00
Andy Wilkinson ee3525aa47 Merge branch '1.5.x' 2017-07-21 15:27:46 +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
Phillip Webb 24d086066b Rework ApplicationContext test helper
Rename `ContextLoader` to `ApplicationContextTester` and provide
distinct subclasses for standard, web and reactive application contexts.

Context callbacks now return AssertJ compatible contexts, allowing
tests to run directly on context. For example:

	context.run((loaded) -> assertThat(loaded).hasBean("foo"));

The returned context can now also represent a context that has failed
to start (meaning that the `loadAndFail` methods are no longer needed):

	context.run((loaded) -> assertThat(loaded).hasFailed());

Configuration classes are loaded via the recently introduced
`Configurations` class. This means that the tester no longer needs to
be directly aware of auto-configuration concepts.

See gh-9634
2017-07-19 12:16:12 -07:00
Phillip Webb c6f55ef46d Add system property support to TestPropertyValues
Update `TestPropertyValues` so that it can also be used to update
system properties.  Properties are set before the call is made and
restored to their previous value afterwards.

Fixes gh-9792
2017-07-19 12:14:26 -07:00
Stephane Nicoll e844c92465 Expose AssertionErrors as is
Closes gh-9760
2017-07-14 18:19:03 +02:00
Andy Wilkinson 3fb1bdef85 Add support to ContextLoader for configuring context's parent
Closes gh-9749
2017-07-13 11:30:26 +01:00
Phillip Webb 8e3baf3130 Polish 2017-07-11 13:57:21 -07:00
Stephane Nicoll ef5c2afcc9 Polish 2017-07-07 11:11:16 +01:00
Andy Wilkinson dd0ce54425 Improve the type-safety of ContextLoader for servlet and reactive web 2017-07-07 11:11:16 +01:00
Andy Wilkinson 19ddfad63e Migrate some more tests to the new ContextLoader 2017-07-07 11:11:16 +01:00
Andy Wilkinson e91b4d0bb3 Polish ContextLoader 2017-07-07 11:11:16 +01:00