Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
a28dd9d9
Commit
a28dd9d9
authored
Mar 30, 2016
by
Johnny Lim
Committed by
Stephane Nicoll
Mar 30, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
Closes gh-5532
parent
8a116200
Changes
34
Show whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
89 additions
and
89 deletions
+89
-89
AutoConfigurationReportLoggingInitializer.java
...re/logging/AutoConfigurationReportLoggingInitializer.java
+1
-1
ConditionEvaluationReportMessage.java
...toconfigure/logging/ConditionEvaluationReportMessage.java
+2
-2
ImportAutoConfigurationTests.java
...work/boot/autoconfigure/ImportAutoConfigurationTests.java
+3
-3
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+3
-3
UserVehicleControllerApplicationTests.java
...ample/test/web/UserVehicleControllerApplicationTests.java
+1
-1
UserVehicleControllerTests.java
...test/java/sample/test/web/UserVehicleControllerTests.java
+1
-1
AutoConfigureReportTestExecutionListener.java
...toconfigure/AutoConfigureReportTestExecutionListener.java
+2
-2
OverrideAutoConfiguration.java
...rk/boot/test/autoconfigure/OverrideAutoConfiguration.java
+1
-1
AnnotationCustomizableTypeExcludeFilter.java
...igure/filter/AnnotationCustomizableTypeExcludeFilter.java
+2
-2
FilterAnnotations.java
...ork/boot/test/autoconfigure/filter/FilterAnnotations.java
+2
-2
JsonExcludeFilter.java
...ework/boot/test/autoconfigure/json/JsonExcludeFilter.java
+1
-1
JsonTesterInitializationTestExecutionListener.java
...e/json/JsonTesterInitializationTestExecutionListener.java
+3
-3
DataJpaTypeExcludeFilter.java
.../test/autoconfigure/orm/jpa/DataJpaTypeExcludeFilter.java
+1
-1
TestEntityManager.java
...rk/boot/test/autoconfigure/orm/jpa/TestEntityManager.java
+3
-3
WebMvcTest.java
...ework/boot/test/autoconfigure/web/servlet/WebMvcTest.java
+1
-1
WebMvcTypeExcludeFilter.java
...st/autoconfigure/web/servlet/WebMvcTypeExcludeFilter.java
+1
-1
AutoConfigureReportTestExecutionListenerTests.java
...figure/AutoConfigureReportTestExecutionListenerTests.java
+1
-1
OverrideAutoConfigurationEnabledTrueIntegrationTest.java
.../OverrideAutoConfigurationEnabledTrueIntegrationTest.java
+1
-1
ExampleJsonComponent.java
...rk/boot/test/autoconfigure/json/ExampleJsonComponent.java
+2
-2
TestEntityManagerTests.java
...ot/test/autoconfigure/orm/jpa/TestEntityManagerTests.java
+2
-2
AnnotationsPropertySourceTests.java
...oconfigure/properties/AnnotationsPropertySourceTests.java
+1
-1
ExampleMapping.java
...rk/boot/test/autoconfigure/properties/ExampleMapping.java
+1
-1
PropertyMappingContextCustomizerFactoryTests.java
...perties/PropertyMappingContextCustomizerFactoryTests.java
+1
-1
PropertyMappingTests.java
...t/test/autoconfigure/properties/PropertyMappingTests.java
+1
-1
SpringBootTestContextBootstrapper.java
.../boot/test/context/SpringBootTestContextBootstrapper.java
+1
-1
MockBean.java
.../org/springframework/boot/test/mock/mockito/MockBean.java
+1
-1
JsonContentAssertTests.java
...pringframework/boot/test/json/JsonContentAssertTests.java
+36
-36
MockitoPostProcessorTests.java
...ork/boot/test/mock/mockito/MockitoPostProcessorTests.java
+1
-1
TypeExcludeFilter.java
...a/org/springframework/boot/context/TypeExcludeFilter.java
+1
-1
LocalServerPort.java
...org/springframework/boot/context/web/LocalServerPort.java
+1
-1
AbstractLoggingSystem.java
...g/springframework/boot/logging/AbstractLoggingSystem.java
+1
-1
LoggingApplicationListener.java
...ingframework/boot/logging/LoggingApplicationListener.java
+6
-6
LoggingSystemProperties.java
...springframework/boot/logging/LoggingSystemProperties.java
+2
-2
LogbackLoggingSystemTests.java
...ework/boot/logging/logback/LogbackLoggingSystemTests.java
+1
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/AutoConfigurationReportLoggingInitializer.java
View file @
a28dd9d9
...
@@ -103,7 +103,7 @@ public class AutoConfigurationReportLoggingInitializer
...
@@ -103,7 +103,7 @@ public class AutoConfigurationReportLoggingInitializer
+
"debug logging (start with --debug)%n%n"
));
+
"debug logging (start with --debug)%n%n"
));
}
}
if
(
this
.
logger
.
isDebugEnabled
())
{
if
(
this
.
logger
.
isDebugEnabled
())
{
this
.
logger
.
debug
(
new
ConditionEvalutionReportMessage
(
this
.
report
));
this
.
logger
.
debug
(
new
ConditionEvalu
a
tionReportMessage
(
this
.
report
));
}
}
}
}
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvalutionReportMessage.java
→
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvalu
a
tionReportMessage.java
View file @
a28dd9d9
...
@@ -35,11 +35,11 @@ import org.springframework.util.StringUtils;
...
@@ -35,11 +35,11 @@ import org.springframework.util.StringUtils;
* @author Phillip Webb
* @author Phillip Webb
* @since 1.4.0
* @since 1.4.0
*/
*/
public
class
ConditionEvalutionReportMessage
{
public
class
ConditionEvalu
a
tionReportMessage
{
private
StringBuilder
message
;
private
StringBuilder
message
;
public
ConditionEvalutionReportMessage
(
ConditionEvaluationReport
report
)
{
public
ConditionEvalu
a
tionReportMessage
(
ConditionEvaluationReport
report
)
{
this
.
message
=
getLogMessage
(
report
);
this
.
message
=
getLogMessage
(
report
);
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationTests.java
View file @
a28dd9d9
...
@@ -47,14 +47,14 @@ public class ImportAutoConfigurationTests {
...
@@ -47,14 +47,14 @@ public class ImportAutoConfigurationTests {
config
);
config
);
String
shortName
=
ClassUtils
.
getShortName
(
ImportAutoConfigurationTests
.
class
);
String
shortName
=
ClassUtils
.
getShortName
(
ImportAutoConfigurationTests
.
class
);
int
beginIndex
=
shortName
.
length
()
+
1
;
int
beginIndex
=
shortName
.
length
()
+
1
;
List
<
String
>
orderdConfigBeans
=
new
ArrayList
<
String
>();
List
<
String
>
order
e
dConfigBeans
=
new
ArrayList
<
String
>();
for
(
String
bean
:
context
.
getBeanDefinitionNames
())
{
for
(
String
bean
:
context
.
getBeanDefinitionNames
())
{
if
(
bean
.
contains
(
"$Config"
))
{
if
(
bean
.
contains
(
"$Config"
))
{
String
shortBeanName
=
ClassUtils
.
getShortName
(
bean
);
String
shortBeanName
=
ClassUtils
.
getShortName
(
bean
);
orderdConfigBeans
.
add
(
shortBeanName
.
substring
(
beginIndex
));
order
e
dConfigBeans
.
add
(
shortBeanName
.
substring
(
beginIndex
));
}
}
}
}
assertThat
(
orderdConfigBeans
).
containsExactly
(
"ConfigA"
,
"ConfigB"
,
"ConfigC"
,
assertThat
(
order
e
dConfigBeans
).
containsExactly
(
"ConfigA"
,
"ConfigB"
,
"ConfigC"
,
"ConfigD"
);
"ConfigD"
);
context
.
close
();
context
.
close
();
}
}
...
...
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
a28dd9d9
...
@@ -4306,7 +4306,7 @@ If you use the
...
@@ -4306,7 +4306,7 @@ If you use the
the following provided libraries:
the following provided libraries:
* http://junit.org[JUnit] -- The de-facto standard for unit testing Java applications.
* http://junit.org[JUnit] -- The de-facto standard for unit testing Java applications.
* {spring-reference}/#integration-testing.html[Spring Test] & Spring Boot Test -- utilties and integration test support for Spring Boot
* {spring-reference}/#integration-testing.html[Spring Test] & Spring Boot Test -- util
i
ties and integration test support for Spring Boot
applications.
applications.
* http://joel-costigliola.github.io/assertj/[AssertJ] - A fluent assertion library.
* http://joel-costigliola.github.io/assertj/[AssertJ] - A fluent assertion library.
* http://hamcrest.org/JavaHamcrest/[Hamcrest] -- A library of matcher objects (also known
* http://hamcrest.org/JavaHamcrest/[Hamcrest] -- A library of matcher objects (also known
...
@@ -4599,7 +4599,7 @@ a little too much for tests. It's often helpful to load only the parts of the
...
@@ -4599,7 +4599,7 @@ a little too much for tests. It's often helpful to load only the parts of the
configuration that are required to test a '`slice`' of your application. For example, you
configuration that are required to test a '`slice`' of your application. For example, you
might want to test that Spring MVC controllers are mapping URLs correctly, and you don't
might want to test that Spring MVC controllers are mapping URLs correctly, and you don't
want to involve and database calls in those tests; or you _might be wanting_ to test JPA
want to involve and database calls in those tests; or you _might be wanting_ to test JPA
entites, and you're not interested in web layer when those tests run.
entit
i
es, and you're not interested in web layer when those tests run.
The `spring-boot-test-autoconfigure` module includes a number of annotations that can be
The `spring-boot-test-autoconfigure` module includes a number of annotations that can be
used to automatically configure such '`slices`'. Each of them work in a similar way,
used to automatically configure such '`slices`'. Each of them work in a similar way,
...
@@ -4615,7 +4615,7 @@ TIP: It's also possible to use the `@AutoConfigure...` annotations with the stan
...
@@ -4615,7 +4615,7 @@ TIP: It's also possible to use the `@AutoConfigure...` annotations with the stan
[[boot-features-testing-spring-boot-applications-testing-autoconfigured-json-tests]]
[[boot-features-testing-spring-boot-applications-testing-autoconfigured-json-tests]]
==== Auto-configured JSON tests
==== Auto-configured JSON tests
To test that Object JSON serilization and deserialization is working as expected you can
To test that Object JSON seri
a
lization and deserialization is working as expected you can
use the `@JsonTest` annotation. `@JsonTest` will auto-configure Jackson ObjectMappers,
use the `@JsonTest` annotation. `@JsonTest` will auto-configure Jackson ObjectMappers,
any `@JsonComponent` beans and any Jackson `Modules`. It also configures `Gson`
any `@JsonComponent` beans and any Jackson `Modules`. It also configures `Gson`
if you happen to be using that instead of, or as well as, Jackson. If you need to
if you happen to be using that instead of, or as well as, Jackson. If you need to
...
...
spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerApplicationTests.java
View file @
a28dd9d9
...
@@ -66,7 +66,7 @@ public class UserVehicleControllerApplicationTests {
...
@@ -66,7 +66,7 @@ public class UserVehicleControllerApplicationTests {
}
}
@Test
@Test
public
void
welcomeCommandLineRunnerShouldBeAvailble
()
throws
Exception
{
public
void
welcomeCommandLineRunnerShouldBeAvail
a
ble
()
throws
Exception
{
// Since we're a @SpringApplicationTest all beans should be available
// Since we're a @SpringApplicationTest all beans should be available
assertThat
(
this
.
applicationContext
.
getBean
(
WelcomeCommandLineRunner
.
class
))
assertThat
(
this
.
applicationContext
.
getBean
(
WelcomeCommandLineRunner
.
class
))
.
isNotNull
();
.
isNotNull
();
...
...
spring-boot-samples/spring-boot-sample-test/src/test/java/sample/test/web/UserVehicleControllerTests.java
View file @
a28dd9d9
...
@@ -101,7 +101,7 @@ public class UserVehicleControllerTests {
...
@@ -101,7 +101,7 @@ public class UserVehicleControllerTests {
}
}
@Test
(
expected
=
NoSuchBeanDefinitionException
.
class
)
@Test
(
expected
=
NoSuchBeanDefinitionException
.
class
)
public
void
welcomeCommandLineRunnerShouldBeAvailble
()
throws
Exception
{
public
void
welcomeCommandLineRunnerShouldBeAvail
a
ble
()
throws
Exception
{
// Since we're a @WebMvcTest WelcomeCommandLineRunner should not be available
// Since we're a @WebMvcTest WelcomeCommandLineRunner should not be available
assertThat
(
this
.
applicationContext
.
getBean
(
WelcomeCommandLineRunner
.
class
));
assertThat
(
this
.
applicationContext
.
getBean
(
WelcomeCommandLineRunner
.
class
));
}
}
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/AutoConfigureReportTestExecutionListener.java
View file @
a28dd9d9
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
package
org
.
springframework
.
boot
.
test
.
autoconfigure
;
package
org
.
springframework
.
boot
.
test
.
autoconfigure
;
import
org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport
;
import
org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport
;
import
org.springframework.boot.autoconfigure.logging.ConditionEvalutionReportMessage
;
import
org.springframework.boot.autoconfigure.logging.ConditionEvalu
a
tionReportMessage
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.test.context.TestContext
;
import
org.springframework.test.context.TestContext
;
...
@@ -50,7 +50,7 @@ class AutoConfigureReportTestExecutionListener extends AbstractTestExecutionList
...
@@ -50,7 +50,7 @@ class AutoConfigureReportTestExecutionListener extends AbstractTestExecutionList
if
(
context
instanceof
ConfigurableApplicationContext
)
{
if
(
context
instanceof
ConfigurableApplicationContext
)
{
ConditionEvaluationReport
report
=
ConditionEvaluationReport
ConditionEvaluationReport
report
=
ConditionEvaluationReport
.
get
(((
ConfigurableApplicationContext
)
context
).
getBeanFactory
());
.
get
(((
ConfigurableApplicationContext
)
context
).
getBeanFactory
());
System
.
err
.
println
(
new
ConditionEvalutionReportMessage
(
report
));
System
.
err
.
println
(
new
ConditionEvalu
a
tionReportMessage
(
report
));
}
}
throw
ex
;
throw
ex
;
}
}
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfiguration.java
View file @
a28dd9d9
...
@@ -28,7 +28,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
...
@@ -28,7 +28,7 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
/**
/**
* Annotation that can be used to override
* Annotation that can be used to override
* {@link EnableAutoConfiguration @EnableAutoConfiguration}. Often used in combination
* {@link EnableAutoConfiguration @EnableAutoConfiguration}. Often used in combination
* with {@link ImportAutoConfiguration} to limit the auto-configu
t
ation classes that are
* with {@link ImportAutoConfiguration} to limit the auto-configu
r
ation classes that are
* loaded.
* loaded.
*
*
* @author Phillip Webb
* @author Phillip Webb
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java
View file @
a28dd9d9
...
@@ -70,7 +70,7 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
...
@@ -70,7 +70,7 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
protected
boolean
defaultInclude
(
MetadataReader
metadataReader
,
protected
boolean
defaultInclude
(
MetadataReader
metadataReader
,
MetadataReaderFactory
metadataReaderFactory
)
throws
IOException
{
MetadataReaderFactory
metadataReaderFactory
)
throws
IOException
{
for
(
Class
<?>
include
:
getDefaultIncudes
())
{
for
(
Class
<?>
include
:
getDefaultInc
l
udes
())
{
if
(
isTypeOrAnnotated
(
metadataReader
,
metadataReaderFactory
,
include
))
{
if
(
isTypeOrAnnotated
(
metadataReader
,
metadataReaderFactory
,
include
))
{
return
true
;
return
true
;
}
}
...
@@ -101,7 +101,7 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
...
@@ -101,7 +101,7 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
protected
abstract
boolean
isUseDefaultFilters
();
protected
abstract
boolean
isUseDefaultFilters
();
protected
abstract
Set
<
Class
<?>>
getDefaultIncudes
();
protected
abstract
Set
<
Class
<?>>
getDefaultInc
l
udes
();
protected
static
enum
FilterType
{
protected
static
enum
FilterType
{
INCLUDE
,
EXCLUDE
INCLUDE
,
EXCLUDE
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/FilterAnnotations.java
View file @
a28dd9d9
...
@@ -72,13 +72,13 @@ public class FilterAnnotations implements Iterable<TypeFilter> {
...
@@ -72,13 +72,13 @@ public class FilterAnnotations implements Iterable<TypeFilter> {
switch
(
filterType
)
{
switch
(
filterType
)
{
case
ANNOTATION:
case
ANNOTATION:
Assert
.
isAssignable
(
Annotation
.
class
,
filterClass
,
Assert
.
isAssignable
(
Annotation
.
class
,
filterClass
,
"An error occured while processing a ANNOTATION type filter: "
);
"An error occur
r
ed while processing a ANNOTATION type filter: "
);
return
new
AnnotationTypeFilter
((
Class
<
Annotation
>)
filterClass
);
return
new
AnnotationTypeFilter
((
Class
<
Annotation
>)
filterClass
);
case
ASSIGNABLE_TYPE:
case
ASSIGNABLE_TYPE:
return
new
AssignableTypeFilter
(
filterClass
);
return
new
AssignableTypeFilter
(
filterClass
);
case
CUSTOM:
case
CUSTOM:
Assert
.
isAssignable
(
TypeFilter
.
class
,
filterClass
,
Assert
.
isAssignable
(
TypeFilter
.
class
,
filterClass
,
"An error occured while processing a CUSTOM type filter: "
);
"An error occur
r
ed while processing a CUSTOM type filter: "
);
return
BeanUtils
.
instantiateClass
(
filterClass
,
TypeFilter
.
class
);
return
BeanUtils
.
instantiateClass
(
filterClass
,
TypeFilter
.
class
);
}
}
throw
new
IllegalArgumentException
(
throw
new
IllegalArgumentException
(
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonExcludeFilter.java
View file @
a28dd9d9
...
@@ -73,7 +73,7 @@ class JsonExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
...
@@ -73,7 +73,7 @@ class JsonExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
}
}
@Override
@Override
protected
Set
<
Class
<?>>
getDefaultIncudes
()
{
protected
Set
<
Class
<?>>
getDefaultInc
l
udes
()
{
return
DEFAULT_INCLUDES
;
return
DEFAULT_INCLUDES
;
}
}
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTesterInitializationTestExecutionListener.java
View file @
a28dd9d9
...
@@ -49,14 +49,14 @@ public class JsonTesterInitializationTestExecutionListener
...
@@ -49,14 +49,14 @@ public class JsonTesterInitializationTestExecutionListener
private
static
final
String
ASSERTJ_CLASS
=
"org.assertj.core.api.Assert"
;
private
static
final
String
ASSERTJ_CLASS
=
"org.assertj.core.api.Assert"
;
private
static
final
Map
<
String
,
Class
<?>>
INITALIZERS
;
private
static
final
Map
<
String
,
Class
<?>>
INIT
I
ALIZERS
;
static
{
static
{
Map
<
String
,
Class
<?>>
initializers
=
new
LinkedHashMap
<
String
,
Class
<?>>();
Map
<
String
,
Class
<?>>
initializers
=
new
LinkedHashMap
<
String
,
Class
<?>>();
initializers
.
put
(
"com.fasterxml.jackson.databind.ObjectMapper"
,
initializers
.
put
(
"com.fasterxml.jackson.databind.ObjectMapper"
,
JacksonInitializer
.
class
);
JacksonInitializer
.
class
);
initializers
.
put
(
"com.google.gson.Gson"
,
GsonInitializer
.
class
);
initializers
.
put
(
"com.google.gson.Gson"
,
GsonInitializer
.
class
);
INITALIZERS
=
Collections
.
unmodifiableMap
(
initializers
);
INIT
I
ALIZERS
=
Collections
.
unmodifiableMap
(
initializers
);
}
}
@Override
@Override
...
@@ -101,7 +101,7 @@ public class JsonTesterInitializationTestExecutionListener
...
@@ -101,7 +101,7 @@ public class JsonTesterInitializationTestExecutionListener
private
void
initializeJsonMarshalTesterFields
(
ClassLoader
classLoader
,
private
void
initializeJsonMarshalTesterFields
(
ClassLoader
classLoader
,
TestContext
testContext
)
{
TestContext
testContext
)
{
for
(
Map
.
Entry
<
String
,
Class
<?>>
entry
:
INITALIZERS
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Class
<?>>
entry
:
INIT
I
ALIZERS
.
entrySet
())
{
if
(
ClassUtils
.
isPresent
(
entry
.
getKey
(),
classLoader
))
{
if
(
ClassUtils
.
isPresent
(
entry
.
getKey
(),
classLoader
))
{
initializeJsonMarshalTesterFields
(
classLoader
,
testContext
,
initializeJsonMarshalTesterFields
(
classLoader
,
testContext
,
entry
.
getKey
(),
entry
.
getValue
());
entry
.
getKey
(),
entry
.
getValue
());
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/DataJpaTypeExcludeFilter.java
View file @
a28dd9d9
...
@@ -69,7 +69,7 @@ class DataJpaTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
...
@@ -69,7 +69,7 @@ class DataJpaTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
}
}
@Override
@Override
protected
Set
<
Class
<?>>
getDefaultIncudes
()
{
protected
Set
<
Class
<?>>
getDefaultInc
l
udes
()
{
return
Collections
.
emptySet
();
return
Collections
.
emptySet
();
}
}
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestEntityManager.java
View file @
a28dd9d9
...
@@ -103,7 +103,7 @@ public class TestEntityManager {
...
@@ -103,7 +103,7 @@ public class TestEntityManager {
* {@link #getId(Object) entity ID}.
* {@link #getId(Object) entity ID}.
* <p>
* <p>
* Helpful when ensuring that entity data is actually written and read from the
* Helpful when ensuring that entity data is actually written and read from the
* underling database correctly.
* underl
y
ing database correctly.
* @param <E> the entity type
* @param <E> the entity type
* @param entity the entity to persist
* @param entity the entity to persist
* @return the entity found using the ID of the persisted entity
* @return the entity found using the ID of the persisted entity
...
@@ -226,7 +226,7 @@ public class TestEntityManager {
...
@@ -226,7 +226,7 @@ public class TestEntityManager {
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
<
T
>
T
getId
(
Object
entity
,
Class
<
T
>
idType
)
{
public
<
T
>
T
getId
(
Object
entity
,
Class
<
T
>
idType
)
{
Object
id
=
getId
(
entity
);
Object
id
=
getId
(
entity
);
Assert
.
isInstanceOf
(
idType
,
id
,
"ID mis
s
match"
);
Assert
.
isInstanceOf
(
idType
,
id
,
"ID mismatch"
);
return
(
T
)
id
;
return
(
T
)
id
;
}
}
...
@@ -238,7 +238,7 @@ public class TestEntityManager {
...
@@ -238,7 +238,7 @@ public class TestEntityManager {
public
final
EntityManager
getEntityManager
()
{
public
final
EntityManager
getEntityManager
()
{
EntityManager
manager
=
EntityManagerFactoryUtils
EntityManager
manager
=
EntityManagerFactoryUtils
.
getTransactionalEntityManager
(
this
.
entityManagerFactory
);
.
getTransactionalEntityManager
(
this
.
entityManagerFactory
);
Assert
.
state
(
manager
!=
null
,
"No transactional En
iti
yManager found"
);
Assert
.
state
(
manager
!=
null
,
"No transactional En
tit
yManager found"
);
return
manager
;
return
manager
;
}
}
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTest.java
View file @
a28dd9d9
...
@@ -48,7 +48,7 @@ import org.springframework.test.web.servlet.MockMvc;
...
@@ -48,7 +48,7 @@ import org.springframework.test.web.servlet.MockMvc;
* By default, tests annotated with {@code @WebMvcTest} will also auto-configure
* By default, tests annotated with {@code @WebMvcTest} will also auto-configure
* {@link MockMvc} (include support for HtmlUnit WebDriver and Selenium WebClient). For
* {@link MockMvc} (include support for HtmlUnit WebDriver and Selenium WebClient). For
* more fine-grained control of MockMVC that
* more fine-grained control of MockMVC that
* {@link AutoConfigureMockMvc @AutoConfigureMockMvc} annotation ca
b
be used.
* {@link AutoConfigureMockMvc @AutoConfigureMockMvc} annotation ca
n
be used.
* <p>
* <p>
* Typically {@code @WebMvcTest} is used in combination with {@link MockBean @MockBean} or
* Typically {@code @WebMvcTest} is used in combination with {@link MockBean @MockBean} or
* {@link Import @Import} to create any collaborators required by your {@code @Controller}
* {@link Import @Import} to create any collaborators required by your {@code @Controller}
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTypeExcludeFilter.java
View file @
a28dd9d9
...
@@ -108,7 +108,7 @@ class WebMvcTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
...
@@ -108,7 +108,7 @@ class WebMvcTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
}
}
@Override
@Override
protected
Set
<
Class
<?>>
getDefaultIncudes
()
{
protected
Set
<
Class
<?>>
getDefaultInc
l
udes
()
{
if
(
ObjectUtils
.
isEmpty
(
this
.
annotation
.
controllers
()))
{
if
(
ObjectUtils
.
isEmpty
(
this
.
annotation
.
controllers
()))
{
return
DEFAULT_INCLUDES_AND_CONTROLLER
;
return
DEFAULT_INCLUDES_AND_CONTROLLER
;
}
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/AutoConfigureReportTestExecutionListenerTests.java
View file @
a28dd9d9
...
@@ -55,7 +55,7 @@ public class AutoConfigureReportTestExecutionListenerTests {
...
@@ -55,7 +55,7 @@ public class AutoConfigureReportTestExecutionListenerTests {
}
}
@Test
@Test
public
void
prepareF
ia
lingTestInstanceShouldPrintReport
()
throws
Exception
{
public
void
prepareF
ai
lingTestInstanceShouldPrintReport
()
throws
Exception
{
TestContext
testContext
=
mock
(
TestContext
.
class
);
TestContext
testContext
=
mock
(
TestContext
.
class
);
given
(
testContext
.
getTestInstance
()).
willThrow
(
new
IllegalStateException
());
given
(
testContext
.
getTestInstance
()).
willThrow
(
new
IllegalStateException
());
SpringApplication
application
=
new
SpringApplication
(
Config
.
class
);
SpringApplication
application
=
new
SpringApplication
(
Config
.
class
);
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationEnabledTrueIntegrationTest.java
View file @
a28dd9d9
...
@@ -45,7 +45,7 @@ public class OverrideAutoConfigurationEnabledTrueIntegrationTest {
...
@@ -45,7 +45,7 @@ public class OverrideAutoConfigurationEnabledTrueIntegrationTest {
private
ApplicationContext
context
;
private
ApplicationContext
context
;
@Test
@Test
public
void
auto
c
onfiguredContext
()
throws
Exception
{
public
void
auto
C
onfiguredContext
()
throws
Exception
{
ApplicationContext
context
=
this
.
context
;
ApplicationContext
context
=
this
.
context
;
assertThat
(
context
.
getBean
(
ExampleSpringBootApplication
.
class
)).
isNotNull
();
assertThat
(
context
.
getBean
(
ExampleSpringBootApplication
.
class
)).
isNotNull
();
assertThat
(
context
.
getBean
(
ConfigurationPropertiesBindingPostProcessor
.
class
))
assertThat
(
context
.
getBean
(
ConfigurationPropertiesBindingPostProcessor
.
class
))
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/ExampleJsonComponent.java
View file @
a28dd9d9
...
@@ -47,10 +47,10 @@ public class ExampleJsonComponent {
...
@@ -47,10 +47,10 @@ public class ExampleJsonComponent {
}
}
public
static
class
Deserialzer
extends
JsonObjectDeserializer
<
ExampleCustomObject
>
{
public
static
class
Deserial
i
zer
extends
JsonObjectDeserializer
<
ExampleCustomObject
>
{
@Override
@Override
protected
ExampleCustomObject
deserializeObject
(
JsonParser
j
a
sonParser
,
protected
ExampleCustomObject
deserializeObject
(
JsonParser
jsonParser
,
DeserializationContext
context
,
ObjectCodec
codec
,
JsonNode
tree
)
DeserializationContext
context
,
ObjectCodec
codec
,
JsonNode
tree
)
throws
IOException
{
throws
IOException
{
return
new
ExampleCustomObject
(
return
new
ExampleCustomObject
(
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/orm/jpa/TestEntityManagerTests.java
View file @
a28dd9d9
...
@@ -202,7 +202,7 @@ public class TestEntityManagerTests {
...
@@ -202,7 +202,7 @@ public class TestEntityManagerTests {
public
void
getIdForTypeWhenTypeIsWrongShouldThrowException
()
throws
Exception
{
public
void
getIdForTypeWhenTypeIsWrongShouldThrowException
()
throws
Exception
{
TestEntity
entity
=
new
TestEntity
();
TestEntity
entity
=
new
TestEntity
();
given
(
this
.
persistenceUnitUtil
.
getIdentifier
(
entity
)).
willReturn
(
123
);
given
(
this
.
persistenceUnitUtil
.
getIdentifier
(
entity
)).
willReturn
(
123
);
this
.
thrown
.
expectMessage
(
"ID mis
s
match Object of class [java.lang.Integer] "
this
.
thrown
.
expectMessage
(
"ID mismatch Object of class [java.lang.Integer] "
+
"must be an instance of class java.lang.Long"
);
+
"must be an instance of class java.lang.Long"
);
this
.
testEntityManager
.
getId
(
entity
,
Long
.
class
);
this
.
testEntityManager
.
getId
(
entity
,
Long
.
class
);
}
}
...
@@ -225,7 +225,7 @@ public class TestEntityManagerTests {
...
@@ -225,7 +225,7 @@ public class TestEntityManagerTests {
@Test
@Test
public
void
getEntityManagerWhenNotSetShouldThrowException
()
throws
Exception
{
public
void
getEntityManagerWhenNotSetShouldThrowException
()
throws
Exception
{
this
.
thrown
.
expect
(
IllegalStateException
.
class
);
this
.
thrown
.
expect
(
IllegalStateException
.
class
);
this
.
thrown
.
expectMessage
(
"No transactional En
iti
yManager found"
);
this
.
thrown
.
expectMessage
(
"No transactional En
tit
yManager found"
);
this
.
testEntityManager
.
getEntityManager
();
this
.
testEntityManager
.
getEntityManager
();
}
}
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySourceTests.java
View file @
a28dd9d9
...
@@ -104,7 +104,7 @@ public class AnnotationsPropertySourceTests {
...
@@ -104,7 +104,7 @@ public class AnnotationsPropertySourceTests {
}
}
@Test
@Test
public
void
propertiesWhenCo
untainsArrya
sShouldExpandNames
()
throws
Exception
{
public
void
propertiesWhenCo
ntainsArray
sShouldExpandNames
()
throws
Exception
{
AnnotationsPropertySource
source
=
new
AnnotationsPropertySource
(
Arrays
.
class
);
AnnotationsPropertySource
source
=
new
AnnotationsPropertySource
(
Arrays
.
class
);
assertThat
(
source
.
getPropertyNames
()).
contains
(
"strings[0]"
,
"strings[1]"
,
assertThat
(
source
.
getPropertyNames
()).
contains
(
"strings[0]"
,
"strings[1]"
,
"classes[0]"
,
"classes[1]"
,
"ints[0]"
,
"ints[1]"
,
"longs[0]"
,
"longs[1]"
,
"classes[0]"
,
"classes[1]"
,
"ints[0]"
,
"ints[1]"
,
"longs[0]"
,
"longs[1]"
,
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/ExampleMapping.java
View file @
a28dd9d9
...
@@ -20,7 +20,7 @@ import java.lang.annotation.Retention;
...
@@ -20,7 +20,7 @@ import java.lang.annotation.Retention;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.RetentionPolicy
;
/**
/**
* Example {@link PropertyMapping} annotation for use w
u
th {@link PropertyMappingTests}.
* Example {@link PropertyMapping} annotation for use w
i
th {@link PropertyMappingTests}.
*
*
* @author Phillip Webb
* @author Phillip Webb
*/
*/
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java
View file @
a28dd9d9
...
@@ -78,7 +78,7 @@ public class PropertyMappingContextCustomizerFactoryTests {
...
@@ -78,7 +78,7 @@ public class PropertyMappingContextCustomizerFactoryTests {
}
}
@Test
@Test
public
void
hashCodeAndEqualsShoudBeBasedOnPropertyValues
()
throws
Exception
{
public
void
hashCodeAndEqualsShou
l
dBeBasedOnPropertyValues
()
throws
Exception
{
ContextCustomizer
customizer1
=
this
.
factory
ContextCustomizer
customizer1
=
this
.
factory
.
createContextCustomizer
(
TypeMapping
.
class
,
null
);
.
createContextCustomizer
(
TypeMapping
.
class
,
null
);
ContextCustomizer
customizer2
=
this
.
factory
ContextCustomizer
customizer2
=
this
.
factory
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingTests.java
View file @
a28dd9d9
...
@@ -26,7 +26,7 @@ import org.springframework.test.context.junit4.SpringRunner;
...
@@ -26,7 +26,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
/**
/**
* Integration tests for {@link PropertyMapping @PropertyMapping} annotaions.
* Integration tests for {@link PropertyMapping @PropertyMapping} annota
t
ions.
*
*
* @author Phillip Webb
* @author Phillip Webb
*/
*/
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java
View file @
a28dd9d9
...
@@ -118,7 +118,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
...
@@ -118,7 +118,7 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr
* differentiate regular tests and bootstrapped tests. Without this property a cached
* differentiate regular tests and bootstrapped tests. Without this property a cached
* context could be returned that wasn't created by this bootstrapper. By default uses
* context could be returned that wasn't created by this bootstrapper. By default uses
* the bootstrapper class as a property.
* the bootstrapper class as a property.
* @return the differentator or {@code null}
* @return the different
i
ator or {@code null}
*/
*/
protected
String
getDifferentiatorPropertySourceProperty
()
{
protected
String
getDifferentiatorPropertySourceProperty
()
{
return
getClass
().
getName
()
+
"=true"
;
return
getClass
().
getName
()
+
"=true"
;
...
...
spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockBean.java
View file @
a28dd9d9
...
@@ -103,7 +103,7 @@ public @interface MockBean {
...
@@ -103,7 +103,7 @@ public @interface MockBean {
* When {@code @MockBean} also defines a {@code name} this attribute can only contain
* When {@code @MockBean} also defines a {@code name} this attribute can only contain
* a single value.
* a single value.
* <p>
* <p>
* If this is the only attribute specified consider using the {@code value} al
ai
s
* If this is the only attribute specified consider using the {@code value} al
ia
s
* instead.
* instead.
*/
*/
@AliasFor
(
"value"
)
@AliasFor
(
"value"
)
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/json/JsonContentAssertTests.java
View file @
a28dd9d9
...
@@ -289,95 +289,95 @@ public class JsonContentAssertTests {
...
@@ -289,95 +289,95 @@ public class JsonContentAssertTests {
}
}
@Test
@Test
public
void
isEqualToJsonWhenStringIsMatchingAndL
i
enientShouldPass
()
public
void
isEqualToJsonWhenStringIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
LENIENT_SAME
,
JSONCompareMode
.
LENIENT
);
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
LENIENT_SAME
,
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isEqualToJsonWhenStringIsNotMatchingAndL
i
enientShouldFail
()
public
void
isEqualToJsonWhenStringIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
DIFFERENT
,
JSONCompareMode
.
LENIENT
);
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
DIFFERENT
,
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isEqualToJsonWhenResourcePathIsMatchingAndL
i
enientShouldPass
()
public
void
isEqualToJsonWhenResourcePathIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
"lenient-same.json"
,
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
"lenient-same.json"
,
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isEqualToJsonWhenResourcePathIsNotMatchingAndL
i
enientShouldFail
()
public
void
isEqualToJsonWhenResourcePathIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
"different.json"
,
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
"different.json"
,
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isEqualToJsonWhenResourcePathAndClassIsMatchingAndL
i
enientShouldPass
()
public
void
isEqualToJsonWhenResourcePathAndClassIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
"lenient-same.json"
,
getClass
(),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
"lenient-same.json"
,
getClass
(),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isEqualToJsonWhenResourcePathAndClassIsNotMatchingAndL
i
enientShouldFail
()
public
void
isEqualToJsonWhenResourcePathAndClassIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
"different.json"
,
getClass
(),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
"different.json"
,
getClass
(),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isEqualToJsonWhenBytesAreMatchingAndL
i
enientShouldPass
()
public
void
isEqualToJsonWhenBytesAreMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
LENIENT_SAME
.
getBytes
(),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
LENIENT_SAME
.
getBytes
(),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isEqualToJsonWhenBytesAreNotMatchingAndL
i
enientShouldFail
()
public
void
isEqualToJsonWhenBytesAreNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
DIFFERENT
.
getBytes
(),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
DIFFERENT
.
getBytes
(),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isEqualToJsonWhenFileIsMatchingAndL
i
enientShouldPass
()
throws
Exception
{
public
void
isEqualToJsonWhenFileIsMatchingAndLenientShouldPass
()
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createFile
(
LENIENT_SAME
),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createFile
(
LENIENT_SAME
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isEqualToJsonWhenFileIsNotMatchingAndL
i
enientShouldFail
()
public
void
isEqualToJsonWhenFileIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createFile
(
DIFFERENT
),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createFile
(
DIFFERENT
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isEqualToJsonWhenInputStreamIsMatchingAndL
i
enientShouldPass
()
public
void
isEqualToJsonWhenInputStreamIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createInputStream
(
LENIENT_SAME
),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createInputStream
(
LENIENT_SAME
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isEqualToJsonWhenInputStreamIsNotMatchingAndL
i
enientShouldFail
()
public
void
isEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createInputStream
(
DIFFERENT
),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createInputStream
(
DIFFERENT
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isEqualToJsonWhenResourceIsMatchingAndL
i
enientShouldPass
()
public
void
isEqualToJsonWhenResourceIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createResource
(
LENIENT_SAME
),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createResource
(
LENIENT_SAME
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isEqualToJsonWhenResourceIsNotMatchingAndL
i
enientShouldFail
()
public
void
isEqualToJsonWhenResourceIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createResource
(
DIFFERENT
),
assertThat
(
forJson
(
SOURCE
)).
isEqualToJson
(
createResource
(
DIFFERENT
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
...
@@ -712,97 +712,97 @@ public class JsonContentAssertTests {
...
@@ -712,97 +712,97 @@ public class JsonContentAssertTests {
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isNotEqualToJsonWhenStringIsMatchingAndL
i
enientShouldPass
()
public
void
isNotEqualToJsonWhenStringIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
LENIENT_SAME
,
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
LENIENT_SAME
,
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isNotEqualToJsonWhenStringIsNotMatchingAndL
i
enientShouldFail
()
public
void
isNotEqualToJsonWhenStringIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
DIFFERENT
,
JSONCompareMode
.
LENIENT
);
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
DIFFERENT
,
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isNotEqualToJsonWhenResourcePathIsMatchingAndL
i
enientShouldPass
()
public
void
isNotEqualToJsonWhenResourcePathIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
"lenient-same.json"
,
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
"lenient-same.json"
,
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isNotEqualToJsonWhenResourcePathIsNotMatchingAndL
i
enientShouldFail
()
public
void
isNotEqualToJsonWhenResourcePathIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
"different.json"
,
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
"different.json"
,
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isNotEqualToJsonWhenResourcePathAndClassIsMatchingAndL
i
enientShouldPass
()
public
void
isNotEqualToJsonWhenResourcePathAndClassIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
"lenient-same.json"
,
getClass
(),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
"lenient-same.json"
,
getClass
(),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isNotEqualToJsonWhenResourcePathAndClassIsNotMatchingAndL
i
enientShouldFail
()
public
void
isNotEqualToJsonWhenResourcePathAndClassIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
"different.json"
,
getClass
(),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
"different.json"
,
getClass
(),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isNotEqualToJsonWhenBytesAreMatchingAndL
i
enientShouldPass
()
public
void
isNotEqualToJsonWhenBytesAreMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
LENIENT_SAME
.
getBytes
(),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
LENIENT_SAME
.
getBytes
(),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isNotEqualToJsonWhenBytesAreNotMatchingAndL
i
enientShouldFail
()
public
void
isNotEqualToJsonWhenBytesAreNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
DIFFERENT
.
getBytes
(),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
DIFFERENT
.
getBytes
(),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isNotEqualToJsonWhenFileIsMatchingAndL
i
enientShouldPass
()
public
void
isNotEqualToJsonWhenFileIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createFile
(
LENIENT_SAME
),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createFile
(
LENIENT_SAME
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isNotEqualToJsonWhenFileIsNotMatchingAndL
i
enientShouldFail
()
public
void
isNotEqualToJsonWhenFileIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createFile
(
DIFFERENT
),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createFile
(
DIFFERENT
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isNotEqualToJsonWhenInputStreamIsMatchingAndL
i
enientShouldPass
()
public
void
isNotEqualToJsonWhenInputStreamIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createInputStream
(
LENIENT_SAME
),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createInputStream
(
LENIENT_SAME
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isNotEqualToJsonWhenInputStreamIsNotMatchingAndL
i
enientShouldFail
()
public
void
isNotEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createInputStream
(
DIFFERENT
),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createInputStream
(
DIFFERENT
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
(
expected
=
AssertionError
.
class
)
@Test
(
expected
=
AssertionError
.
class
)
public
void
isNotEqualToJsonWhenResourceIsMatchingAndL
i
enientShouldPass
()
public
void
isNotEqualToJsonWhenResourceIsMatchingAndLenientShouldPass
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createResource
(
LENIENT_SAME
),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createResource
(
LENIENT_SAME
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
}
}
@Test
@Test
public
void
isNotEqualToJsonWhenResourceIsNotMatchingAndL
i
enientShouldFail
()
public
void
isNotEqualToJsonWhenResourceIsNotMatchingAndLenientShouldFail
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createResource
(
DIFFERENT
),
assertThat
(
forJson
(
SOURCE
)).
isNotEqualToJson
(
createResource
(
DIFFERENT
),
JSONCompareMode
.
LENIENT
);
JSONCompareMode
.
LENIENT
);
...
@@ -924,13 +924,13 @@ public class JsonContentAssertTests {
...
@@ -924,13 +924,13 @@ public class JsonContentAssertTests {
}
}
@Test
@Test
public
void
hasJsonPathValueForIndefin
a
tePathWithResults
()
throws
Exception
{
public
void
hasJsonPathValueForIndefin
i
tePathWithResults
()
throws
Exception
{
assertThat
(
forJson
(
SIMPSONS
))
assertThat
(
forJson
(
SIMPSONS
))
.
hasJsonPathValue
(
"$.familyMembers[?(@.name == 'Bart')]"
);
.
hasJsonPathValue
(
"$.familyMembers[?(@.name == 'Bart')]"
);
}
}
@Test
@Test
public
void
hasJsonPathValueForIndefin
a
tePathWithEmptyResults
()
throws
Exception
{
public
void
hasJsonPathValueForIndefin
i
tePathWithEmptyResults
()
throws
Exception
{
String
expression
=
"$.familyMembers[?(@.name == 'Dilbert')]"
;
String
expression
=
"$.familyMembers[?(@.name == 'Dilbert')]"
;
this
.
thrown
.
expect
(
AssertionError
.
class
);
this
.
thrown
.
expect
(
AssertionError
.
class
);
this
.
thrown
.
expectMessage
(
"No value at JSON path \""
+
expression
+
"\""
);
this
.
thrown
.
expectMessage
(
"No value at JSON path \""
+
expression
+
"\""
);
...
@@ -961,7 +961,7 @@ public class JsonContentAssertTests {
...
@@ -961,7 +961,7 @@ public class JsonContentAssertTests {
}
}
@Test
@Test
public
void
doesNotHaveJsonPathValueForIndefin
a
tePathWithResults
()
throws
Exception
{
public
void
doesNotHaveJsonPathValueForIndefin
i
tePathWithResults
()
throws
Exception
{
String
expression
=
"$.familyMembers[?(@.name == 'Bart')]"
;
String
expression
=
"$.familyMembers[?(@.name == 'Bart')]"
;
this
.
thrown
.
expect
(
AssertionError
.
class
);
this
.
thrown
.
expect
(
AssertionError
.
class
);
this
.
thrown
.
expectMessage
(
"Expected no value at JSON path \""
+
expression
this
.
thrown
.
expectMessage
(
"Expected no value at JSON path \""
+
expression
...
@@ -970,7 +970,7 @@ public class JsonContentAssertTests {
...
@@ -970,7 +970,7 @@ public class JsonContentAssertTests {
}
}
@Test
@Test
public
void
doesNotHaveJsonPathValueForIndefin
a
tePathWithEmptyResults
()
public
void
doesNotHaveJsonPathValueForIndefin
i
tePathWithEmptyResults
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SIMPSONS
))
assertThat
(
forJson
(
SIMPSONS
))
.
doesNotHaveJsonPathValue
(
"$.familyMembers[?(@.name == 'Dilbert')]"
);
.
doesNotHaveJsonPathValue
(
"$.familyMembers[?(@.name == 'Dilbert')]"
);
...
@@ -992,14 +992,14 @@ public class JsonContentAssertTests {
...
@@ -992,14 +992,14 @@ public class JsonContentAssertTests {
}
}
@Test
@Test
public
void
hasEmptyJsonPathValueForIndefin
a
tePathWithEmptyResults
()
public
void
hasEmptyJsonPathValueForIndefin
i
tePathWithEmptyResults
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SIMPSONS
))
assertThat
(
forJson
(
SIMPSONS
))
.
hasEmptyJsonPathValue
(
"$.familyMembers[?(@.name == 'Dilbert')]"
);
.
hasEmptyJsonPathValue
(
"$.familyMembers[?(@.name == 'Dilbert')]"
);
}
}
@Test
@Test
public
void
hasEmptyJsonPathValueForIndefin
a
tePathWithResults
()
throws
Exception
{
public
void
hasEmptyJsonPathValueForIndefin
i
tePathWithResults
()
throws
Exception
{
String
expression
=
"$.familyMembers[?(@.name == 'Bart')]"
;
String
expression
=
"$.familyMembers[?(@.name == 'Bart')]"
;
this
.
thrown
.
expect
(
AssertionError
.
class
);
this
.
thrown
.
expect
(
AssertionError
.
class
);
this
.
thrown
.
expectMessage
(
"Expected an empty value at JSON path \""
+
expression
this
.
thrown
.
expectMessage
(
"Expected an empty value at JSON path \""
+
expression
...
@@ -1042,14 +1042,14 @@ public class JsonContentAssertTests {
...
@@ -1042,14 +1042,14 @@ public class JsonContentAssertTests {
}
}
@Test
@Test
public
void
doesNotHaveEmptyJsonPathValueForIndefin
a
tePathWithResults
()
public
void
doesNotHaveEmptyJsonPathValueForIndefin
i
tePathWithResults
()
throws
Exception
{
throws
Exception
{
assertThat
(
forJson
(
SIMPSONS
))
assertThat
(
forJson
(
SIMPSONS
))
.
doesNotHaveEmptyJsonPathValue
(
"$.familyMembers[?(@.name == 'Bart')]"
);
.
doesNotHaveEmptyJsonPathValue
(
"$.familyMembers[?(@.name == 'Bart')]"
);
}
}
@Test
@Test
public
void
doesNotHaveEmptyJsonPathValueForIndefin
a
tePathWithEmptyResults
()
public
void
doesNotHaveEmptyJsonPathValueForIndefin
i
tePathWithEmptyResults
()
throws
Exception
{
throws
Exception
{
String
expression
=
"$.familyMembers[?(@.name == 'Dilbert')]"
;
String
expression
=
"$.familyMembers[?(@.name == 'Dilbert')]"
;
this
.
thrown
.
expect
(
AssertionError
.
class
);
this
.
thrown
.
expect
(
AssertionError
.
class
);
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessorTests.java
View file @
a28dd9d9
...
@@ -38,7 +38,7 @@ public class MockitoPostProcessorTests {
...
@@ -38,7 +38,7 @@ public class MockitoPostProcessorTests {
public
ExpectedException
thrown
=
ExpectedException
.
none
();
public
ExpectedException
thrown
=
ExpectedException
.
none
();
@Test
@Test
public
void
cannotMockMulipleBeans
()
{
public
void
cannotMockMul
t
ipleBeans
()
{
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
();
MockitoPostProcessor
.
register
(
context
);
MockitoPostProcessor
.
register
(
context
);
context
.
register
(
MultipleBeans
.
class
);
context
.
register
(
MultipleBeans
.
class
);
...
...
spring-boot/src/main/java/org/springframework/boot/context/TypeExcludeFilter.java
View file @
a28dd9d9
...
@@ -39,7 +39,7 @@ import org.springframework.core.type.filter.TypeFilter;
...
@@ -39,7 +39,7 @@ import org.springframework.core.type.filter.TypeFilter;
* override the {@link #match(MetadataReader, MetadataReaderFactory)} method.
* override the {@link #match(MetadataReader, MetadataReaderFactory)} method.
* <p>
* <p>
* Note that {@code TypeExcludeFilters} are initialized very early in the application
* Note that {@code TypeExcludeFilters} are initialized very early in the application
* lifecyle, they should generally not have dependencies on any other beans. They and are
* lifecy
c
le, they should generally not have dependencies on any other beans. They and are
* primarily used internally to support {@code spring-boot-test}.
* primarily used internally to support {@code spring-boot-test}.
*
*
* @author Phillip Webb
* @author Phillip Webb
...
...
spring-boot/src/main/java/org/springframework/boot/context/web/LocalServerPort.java
View file @
a28dd9d9
...
@@ -26,7 +26,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -26,7 +26,7 @@ import org.springframework.beans.factory.annotation.Value;
/**
/**
* Annotation at the field or method/constructor parameter level that injects the HTTP
* Annotation at the field or method/constructor parameter level that injects the HTTP
* port that got allocated at runtime. Pr
iv
des a convenient alternative for
* port that got allocated at runtime. Pr
ovi
des a convenient alternative for
* <code>@Value("${local.server.port}")</code>.
* <code>@Value("${local.server.port}")</code>.
*
*
* @author Anand Shah
* @author Anand Shah
...
...
spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java
View file @
a28dd9d9
...
@@ -170,7 +170,7 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
...
@@ -170,7 +170,7 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
}
}
protected
final
void
applySystemProperties
(
Environment
environment
,
LogFile
logFile
)
{
protected
final
void
applySystemProperties
(
Environment
environment
,
LogFile
logFile
)
{
new
LoggingSytemProperties
(
environment
).
apply
(
logFile
);
new
LoggingSy
s
temProperties
(
environment
).
apply
(
logFile
);
}
}
}
}
spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java
View file @
a28dd9d9
...
@@ -102,12 +102,12 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -102,12 +102,12 @@ public class LoggingApplicationListener implements GenericApplicationListener {
/**
/**
* The name of the System property that contains the process ID.
* The name of the System property that contains the process ID.
*/
*/
public
static
final
String
PID_KEY
=
LoggingSytemProperties
.
PID_KEY
;
public
static
final
String
PID_KEY
=
LoggingSy
s
temProperties
.
PID_KEY
;
/**
/**
* The name of the System property that contains the exception conversion word.
* The name of the System property that contains the exception conversion word.
*/
*/
public
static
final
String
EXCEPTION_CONVERSION_WORD
=
LoggingSytemProperties
.
EXCEPTION_CONVERSION_WORD
;
public
static
final
String
EXCEPTION_CONVERSION_WORD
=
LoggingSy
s
temProperties
.
EXCEPTION_CONVERSION_WORD
;
/**
/**
* The name of the System property that contains the log file.
* The name of the System property that contains the log file.
...
@@ -122,17 +122,17 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -122,17 +122,17 @@ public class LoggingApplicationListener implements GenericApplicationListener {
/**
/**
* The name of the System property that contains the console log pattern.
* The name of the System property that contains the console log pattern.
*/
*/
public
static
final
String
CONSOLE_LOG_PATTERN
=
LoggingSytemProperties
.
CONSOLE_LOG_PATTERN
;
public
static
final
String
CONSOLE_LOG_PATTERN
=
LoggingSy
s
temProperties
.
CONSOLE_LOG_PATTERN
;
/**
/**
* The name of the System property that contains the file log pattern.
* The name of the System property that contains the file log pattern.
*/
*/
public
static
final
String
FILE_LOG_PATTERN
=
LoggingSytemProperties
.
FILE_LOG_PATTERN
;
public
static
final
String
FILE_LOG_PATTERN
=
LoggingSy
s
temProperties
.
FILE_LOG_PATTERN
;
/**
/**
* The name of the System property that contains the log level pattern.
* The name of the System property that contains the log level pattern.
*/
*/
public
static
final
String
LOG_LEVEL_PATTERN
=
LoggingSytemProperties
.
LOG_LEVEL_PATTERN
;
public
static
final
String
LOG_LEVEL_PATTERN
=
LoggingSy
s
temProperties
.
LOG_LEVEL_PATTERN
;
/**
/**
* The name of the {@link LoggingSystem} bean.
* The name of the {@link LoggingSystem} bean.
...
@@ -247,7 +247,7 @@ public class LoggingApplicationListener implements GenericApplicationListener {
...
@@ -247,7 +247,7 @@ public class LoggingApplicationListener implements GenericApplicationListener {
*/
*/
protected
void
initialize
(
ConfigurableEnvironment
environment
,
protected
void
initialize
(
ConfigurableEnvironment
environment
,
ClassLoader
classLoader
)
{
ClassLoader
classLoader
)
{
new
LoggingSytemProperties
(
environment
).
apply
();
new
LoggingSy
s
temProperties
(
environment
).
apply
();
LogFile
logFile
=
LogFile
.
get
(
environment
);
LogFile
logFile
=
LogFile
.
get
(
environment
);
if
(
logFile
!=
null
)
{
if
(
logFile
!=
null
)
{
logFile
.
applyToSystemProperties
();
logFile
.
applyToSystemProperties
();
...
...
spring-boot/src/main/java/org/springframework/boot/logging/LoggingSytemProperties.java
→
spring-boot/src/main/java/org/springframework/boot/logging/LoggingSy
s
temProperties.java
View file @
a28dd9d9
...
@@ -26,7 +26,7 @@ import org.springframework.core.env.Environment;
...
@@ -26,7 +26,7 @@ import org.springframework.core.env.Environment;
* @author Andy Wilkinson
* @author Andy Wilkinson
* @author Phillip Webb
* @author Phillip Webb
*/
*/
class
LoggingSytemProperties
{
class
LoggingSy
s
temProperties
{
static
final
String
PID_KEY
=
"PID"
;
static
final
String
PID_KEY
=
"PID"
;
...
@@ -40,7 +40,7 @@ class LoggingSytemProperties {
...
@@ -40,7 +40,7 @@ class LoggingSytemProperties {
private
final
Environment
environment
;
private
final
Environment
environment
;
LoggingSytemProperties
(
Environment
environment
)
{
LoggingSy
s
temProperties
(
Environment
environment
)
{
this
.
environment
=
environment
;
this
.
environment
=
environment
;
}
}
...
...
spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java
View file @
a28dd9d9
...
@@ -304,7 +304,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
...
@@ -304,7 +304,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
}
}
@Test
@Test
public
void
reinitializeShouldSetSytemProperty
()
throws
Exception
{
public
void
reinitializeShouldSetSy
s
temProperty
()
throws
Exception
{
// gh-5491
// gh-5491
this
.
loggingSystem
.
beforeInitialize
();
this
.
loggingSystem
.
beforeInitialize
();
this
.
logger
.
info
(
"Hidden"
);
this
.
logger
.
info
(
"Hidden"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment