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
8ecdf919
Commit
8ecdf919
authored
Oct 22, 2019
by
dreis2211
Committed by
Stephane Nicoll
Oct 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Mockito deprecations
See gh-18689
parent
511a2a07
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
47 additions
and
47 deletions
+47
-47
MeterRegistryConfigurerTests.java
...e/autoconfigure/metrics/MeterRegistryConfigurerTests.java
+2
-2
HealthWebEndpointResponseMapperTests.java
.../actuate/health/HealthWebEndpointResponseMapperTests.java
+5
-5
LoggersEndpointWebIntegrationTests.java
...t/actuate/logging/LoggersEndpointWebIntegrationTests.java
+2
-2
PrometheusPushGatewayManagerTests.java
.../export/prometheus/PrometheusPushGatewayManagerTests.java
+2
-2
ImportAutoConfigurationImportSelectorTests.java
...configure/ImportAutoConfigurationImportSelectorTests.java
+2
-2
QuartzAutoConfigurationTests.java
...ot/autoconfigure/quartz/QuartzAutoConfigurationTests.java
+2
-2
DispatcherFilterTests.java
...rk/boot/devtools/remote/server/DispatcherFilterTests.java
+3
-3
DispatcherTests.java
...ramework/boot/devtools/remote/server/DispatcherTests.java
+2
-2
RestarterTests.java
...springframework/boot/devtools/restart/RestarterTests.java
+2
-2
HttpRestartServerTests.java
.../boot/devtools/restart/server/HttpRestartServerTests.java
+3
-3
PropertyMappingContextCustomizerFactoryTests.java
...perties/PropertyMappingContextCustomizerFactoryTests.java
+2
-2
SpringBootExceptionHandlerTests.java
...springframework/boot/SpringBootExceptionHandlerTests.java
+2
-2
BindResultTests.java
...amework/boot/context/properties/bind/BindResultTests.java
+4
-4
DeferredLogTests.java
...va/org/springframework/boot/logging/DeferredLogTests.java
+2
-2
TaskExecutorBuilderTests.java
...g/springframework/boot/task/TaskExecutorBuilderTests.java
+2
-2
TaskSchedulerBuilderTests.java
.../springframework/boot/task/TaskSchedulerBuilderTests.java
+2
-2
LambdaSafeTests.java
...t/java/org/springframework/boot/util/LambdaSafeTests.java
+4
-4
RestTemplateBuilderTests.java
...ngframework/boot/web/client/RestTemplateBuilderTests.java
+2
-2
WebServiceTemplateBuilderTests.java
...ot/webservices/client/WebServiceTemplateBuilderTests.java
+2
-2
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerTests.java
View file @
8ecdf919
...
@@ -38,7 +38,7 @@ import static org.mockito.BDDMockito.given;
...
@@ -38,7 +38,7 @@ import static org.mockito.BDDMockito.given;
import
static
org
.
mockito
.
Mockito
.
inOrder
;
import
static
org
.
mockito
.
Mockito
.
inOrder
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link MeterRegistryConfigurer}.
* Tests for {@link MeterRegistryConfigurer}.
...
@@ -128,7 +128,7 @@ class MeterRegistryConfigurerTests {
...
@@ -128,7 +128,7 @@ class MeterRegistryConfigurerTests {
MeterRegistryConfigurer
configurer
=
new
MeterRegistryConfigurer
(
createObjectProvider
(
this
.
customizers
),
MeterRegistryConfigurer
configurer
=
new
MeterRegistryConfigurer
(
createObjectProvider
(
this
.
customizers
),
createObjectProvider
(
this
.
filters
),
createObjectProvider
(
this
.
binders
),
false
,
true
);
createObjectProvider
(
this
.
filters
),
createObjectProvider
(
this
.
binders
),
false
,
true
);
configurer
.
configure
(
this
.
mockRegistry
);
configurer
.
configure
(
this
.
mockRegistry
);
verify
Zer
oInteractions
(
this
.
mockBinder
);
verify
N
oInteractions
(
this
.
mockBinder
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthWebEndpointResponseMapperTests.java
View file @
8ecdf919
...
@@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.anyString;
...
@@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.anyString;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link HealthWebEndpointResponseMapper}.
* Tests for {@link HealthWebEndpointResponseMapper}.
...
@@ -56,8 +56,8 @@ class HealthWebEndpointResponseMapperTests {
...
@@ -56,8 +56,8 @@ class HealthWebEndpointResponseMapperTests {
SecurityContext
securityContext
=
mock
(
SecurityContext
.
class
);
SecurityContext
securityContext
=
mock
(
SecurityContext
.
class
);
WebEndpointResponse
<
Health
>
response
=
mapper
.
mapDetails
(
supplier
,
securityContext
);
WebEndpointResponse
<
Health
>
response
=
mapper
.
mapDetails
(
supplier
,
securityContext
);
assertThat
(
response
.
getStatus
()).
isEqualTo
(
HttpStatus
.
NOT_FOUND
.
value
());
assertThat
(
response
.
getStatus
()).
isEqualTo
(
HttpStatus
.
NOT_FOUND
.
value
());
verify
Zer
oInteractions
(
supplier
);
verify
N
oInteractions
(
supplier
);
verify
Zer
oInteractions
(
securityContext
);
verify
N
oInteractions
(
securityContext
);
}
}
@Test
@Test
...
@@ -68,7 +68,7 @@ class HealthWebEndpointResponseMapperTests {
...
@@ -68,7 +68,7 @@ class HealthWebEndpointResponseMapperTests {
WebEndpointResponse
<
Health
>
response
=
mapper
.
mapDetails
(
supplier
,
securityContext
);
WebEndpointResponse
<
Health
>
response
=
mapper
.
mapDetails
(
supplier
,
securityContext
);
assertThat
(
response
.
getStatus
()).
isEqualTo
(
HttpStatus
.
NOT_FOUND
.
value
());
assertThat
(
response
.
getStatus
()).
isEqualTo
(
HttpStatus
.
NOT_FOUND
.
value
());
assertThat
(
response
.
getBody
()).
isNull
();
assertThat
(
response
.
getBody
()).
isNull
();
verify
Zer
oInteractions
(
supplier
);
verify
N
oInteractions
(
supplier
);
verify
(
securityContext
).
isUserInRole
(
"ACTUATOR"
);
verify
(
securityContext
).
isUserInRole
(
"ACTUATOR"
);
}
}
...
@@ -94,7 +94,7 @@ class HealthWebEndpointResponseMapperTests {
...
@@ -94,7 +94,7 @@ class HealthWebEndpointResponseMapperTests {
assertThat
(
response
.
getStatus
()).
isEqualTo
(
HttpStatus
.
NOT_FOUND
.
value
());
assertThat
(
response
.
getStatus
()).
isEqualTo
(
HttpStatus
.
NOT_FOUND
.
value
());
assertThat
(
response
.
getBody
()).
isNull
();
assertThat
(
response
.
getBody
()).
isNull
();
verify
(
supplier
).
get
();
verify
(
supplier
).
get
();
verify
Zer
oInteractions
(
securityContext
);
verify
N
oInteractions
(
securityContext
);
}
}
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/logging/LoggersEndpointWebIntegrationTests.java
View file @
8ecdf919
...
@@ -45,7 +45,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
...
@@ -45,7 +45,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Integration tests for {@link LoggersEndpoint} when exposed via Jersey, Spring MVC, and
* Integration tests for {@link LoggersEndpoint} when exposed via Jersey, Spring MVC, and
...
@@ -165,7 +165,7 @@ class LoggersEndpointWebIntegrationTests {
...
@@ -165,7 +165,7 @@ class LoggersEndpointWebIntegrationTests {
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
).
contentType
(
MediaType
.
APPLICATION_JSON
)
this
.
client
.
post
().
uri
(
"/actuator/loggers/ROOT"
).
contentType
(
MediaType
.
APPLICATION_JSON
)
.
bodyValue
(
Collections
.
singletonMap
(
"configuredLevel"
,
"other"
)).
exchange
().
expectStatus
()
.
bodyValue
(
Collections
.
singletonMap
(
"configuredLevel"
,
"other"
)).
exchange
().
expectStatus
()
.
isBadRequest
();
.
isBadRequest
();
verify
Zer
oInteractions
(
this
.
loggingSystem
);
verify
N
oInteractions
(
this
.
loggingSystem
);
}
}
@WebEndpointTest
@WebEndpointTest
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusPushGatewayManagerTests.java
View file @
8ecdf919
...
@@ -44,7 +44,7 @@ import static org.mockito.BDDMockito.willThrow;
...
@@ -44,7 +44,7 @@ import static org.mockito.BDDMockito.willThrow;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
never
;
import
static
org
.
mockito
.
Mockito
.
never
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link PrometheusPushGatewayManager}.
* Tests for {@link PrometheusPushGatewayManager}.
...
@@ -162,7 +162,7 @@ class PrometheusPushGatewayManagerTests {
...
@@ -162,7 +162,7 @@ class PrometheusPushGatewayManagerTests {
this
.
scheduler
,
this
.
pushRate
,
"job"
,
this
.
groupingKey
,
ShutdownOperation
.
NONE
);
this
.
scheduler
,
this
.
pushRate
,
"job"
,
this
.
groupingKey
,
ShutdownOperation
.
NONE
);
manager
.
shutdown
();
manager
.
shutdown
();
verify
(
this
.
future
).
cancel
(
false
);
verify
(
this
.
future
).
cancel
(
false
);
verify
Zer
oInteractions
(
this
.
pushGateway
);
verify
N
oInteractions
(
this
.
pushGateway
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelectorTests.java
View file @
8ecdf919
...
@@ -40,7 +40,7 @@ import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
...
@@ -40,7 +40,7 @@ import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ClassUtils
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link ImportAutoConfigurationImportSelector}.
* Tests for {@link ImportAutoConfigurationImportSelector}.
...
@@ -83,7 +83,7 @@ class ImportAutoConfigurationImportSelectorTests {
...
@@ -83,7 +83,7 @@ class ImportAutoConfigurationImportSelectorTests {
void
propertyExclusionsAreNotApplied
()
throws
Exception
{
void
propertyExclusionsAreNotApplied
()
throws
Exception
{
AnnotationMetadata
annotationMetadata
=
getAnnotationMetadata
(
ImportFreeMarker
.
class
);
AnnotationMetadata
annotationMetadata
=
getAnnotationMetadata
(
ImportFreeMarker
.
class
);
this
.
importSelector
.
selectImports
(
annotationMetadata
);
this
.
importSelector
.
selectImports
(
annotationMetadata
);
verify
Zer
oInteractions
(
this
.
environment
);
verify
N
oInteractions
(
this
.
environment
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfigurationTests.java
View file @
8ecdf919
...
@@ -67,7 +67,7 @@ import org.springframework.util.Assert;
...
@@ -67,7 +67,7 @@ import org.springframework.util.Assert;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link QuartzAutoConfiguration}.
* Tests for {@link QuartzAutoConfiguration}.
...
@@ -157,7 +157,7 @@ class QuartzAutoConfigurationTests {
...
@@ -157,7 +157,7 @@ class QuartzAutoConfigurationTests {
Scheduler
scheduler
=
context
.
getBean
(
Scheduler
.
class
);
Scheduler
scheduler
=
context
.
getBean
(
Scheduler
.
class
);
assertThat
(
scheduler
.
getMetaData
().
getThreadPoolSize
()).
isEqualTo
(
50
);
assertThat
(
scheduler
.
getMetaData
().
getThreadPoolSize
()).
isEqualTo
(
50
);
Executor
executor
=
context
.
getBean
(
Executor
.
class
);
Executor
executor
=
context
.
getBean
(
Executor
.
class
);
verify
Zer
oInteractions
(
executor
);
verify
N
oInteractions
(
executor
);
});
});
}
}
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherFilterTests.java
View file @
8ecdf919
...
@@ -42,7 +42,7 @@ import static org.mockito.ArgumentMatchers.any;
...
@@ -42,7 +42,7 @@ import static org.mockito.ArgumentMatchers.any;
import
static
org
.
mockito
.
BDDMockito
.
willReturn
;
import
static
org
.
mockito
.
BDDMockito
.
willReturn
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link DispatcherFilter}.
* Tests for {@link DispatcherFilter}.
...
@@ -82,7 +82,7 @@ class DispatcherFilterTests {
...
@@ -82,7 +82,7 @@ class DispatcherFilterTests {
ServletRequest
request
=
mock
(
ServletRequest
.
class
);
ServletRequest
request
=
mock
(
ServletRequest
.
class
);
ServletResponse
response
=
mock
(
ServletResponse
.
class
);
ServletResponse
response
=
mock
(
ServletResponse
.
class
);
this
.
filter
.
doFilter
(
request
,
response
,
this
.
chain
);
this
.
filter
.
doFilter
(
request
,
response
,
this
.
chain
);
verify
Zer
oInteractions
(
this
.
dispatcher
);
verify
N
oInteractions
(
this
.
dispatcher
);
verify
(
this
.
chain
).
doFilter
(
request
,
response
);
verify
(
this
.
chain
).
doFilter
(
request
,
response
);
}
}
...
@@ -100,7 +100,7 @@ class DispatcherFilterTests {
...
@@ -100,7 +100,7 @@ class DispatcherFilterTests {
HttpServletResponse
response
=
new
MockHttpServletResponse
();
HttpServletResponse
response
=
new
MockHttpServletResponse
();
willReturn
(
true
).
given
(
this
.
dispatcher
).
handle
(
any
(
ServerHttpRequest
.
class
),
any
(
ServerHttpResponse
.
class
));
willReturn
(
true
).
given
(
this
.
dispatcher
).
handle
(
any
(
ServerHttpRequest
.
class
),
any
(
ServerHttpResponse
.
class
));
this
.
filter
.
doFilter
(
request
,
response
,
this
.
chain
);
this
.
filter
.
doFilter
(
request
,
response
,
this
.
chain
);
verify
Zer
oInteractions
(
this
.
chain
);
verify
N
oInteractions
(
this
.
chain
);
verify
(
this
.
dispatcher
).
handle
(
this
.
serverRequestCaptor
.
capture
(),
this
.
serverResponseCaptor
.
capture
());
verify
(
this
.
dispatcher
).
handle
(
this
.
serverRequestCaptor
.
capture
(),
this
.
serverResponseCaptor
.
capture
());
ServerHttpRequest
dispatcherRequest
=
this
.
serverRequestCaptor
.
getValue
();
ServerHttpRequest
dispatcherRequest
=
this
.
serverRequestCaptor
.
getValue
();
ServletServerHttpRequest
actualRequest
=
(
ServletServerHttpRequest
)
dispatcherRequest
;
ServletServerHttpRequest
actualRequest
=
(
ServletServerHttpRequest
)
dispatcherRequest
;
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/server/DispatcherTests.java
View file @
8ecdf919
...
@@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given;
...
@@ -41,7 +41,7 @@ import static org.mockito.BDDMockito.given;
import
static
org
.
mockito
.
Mockito
.
inOrder
;
import
static
org
.
mockito
.
Mockito
.
inOrder
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
withSettings
;
import
static
org
.
mockito
.
Mockito
.
withSettings
;
/**
/**
...
@@ -91,7 +91,7 @@ class DispatcherTests {
...
@@ -91,7 +91,7 @@ class DispatcherTests {
given
(
mapper
.
getHandler
(
any
(
ServerHttpRequest
.
class
))).
willReturn
(
handler
);
given
(
mapper
.
getHandler
(
any
(
ServerHttpRequest
.
class
))).
willReturn
(
handler
);
Dispatcher
dispatcher
=
new
Dispatcher
(
this
.
accessManager
,
Collections
.
singleton
(
mapper
));
Dispatcher
dispatcher
=
new
Dispatcher
(
this
.
accessManager
,
Collections
.
singleton
(
mapper
));
dispatcher
.
handle
(
this
.
serverRequest
,
this
.
serverResponse
);
dispatcher
.
handle
(
this
.
serverRequest
,
this
.
serverResponse
);
verify
Zer
oInteractions
(
handler
);
verify
N
oInteractions
(
handler
);
assertThat
(
this
.
response
.
getStatus
()).
isEqualTo
(
403
);
assertThat
(
this
.
response
.
getStatus
()).
isEqualTo
(
403
);
}
}
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java
View file @
8ecdf919
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
ArgumentMatchers
.
any
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link Restarter}.
* Tests for {@link Restarter}.
...
@@ -136,7 +136,7 @@ class RestarterTests {
...
@@ -136,7 +136,7 @@ class RestarterTests {
ObjectFactory
objectFactory
=
mock
(
ObjectFactory
.
class
);
ObjectFactory
objectFactory
=
mock
(
ObjectFactory
.
class
);
Object
attribute
=
Restarter
.
getInstance
().
getOrAddAttribute
(
"x"
,
objectFactory
);
Object
attribute
=
Restarter
.
getInstance
().
getOrAddAttribute
(
"x"
,
objectFactory
);
assertThat
(
attribute
).
isEqualTo
(
"abc"
);
assertThat
(
attribute
).
isEqualTo
(
"abc"
);
verify
Zer
oInteractions
(
objectFactory
);
verify
N
oInteractions
(
objectFactory
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerTests.java
View file @
8ecdf919
...
@@ -38,7 +38,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
...
@@ -38,7 +38,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatIllegalArgumentException
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatIllegalArgumentException
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link HttpRestartServer}.
* Tests for {@link HttpRestartServer}.
...
@@ -92,7 +92,7 @@ class HttpRestartServerTests {
...
@@ -92,7 +92,7 @@ class HttpRestartServerTests {
MockHttpServletRequest
request
=
new
MockHttpServletRequest
();
MockHttpServletRequest
request
=
new
MockHttpServletRequest
();
MockHttpServletResponse
response
=
new
MockHttpServletResponse
();
MockHttpServletResponse
response
=
new
MockHttpServletResponse
();
this
.
server
.
handle
(
new
ServletServerHttpRequest
(
request
),
new
ServletServerHttpResponse
(
response
));
this
.
server
.
handle
(
new
ServletServerHttpRequest
(
request
),
new
ServletServerHttpResponse
(
response
));
verify
Zer
oInteractions
(
this
.
delegate
);
verify
N
oInteractions
(
this
.
delegate
);
assertThat
(
response
.
getStatus
()).
isEqualTo
(
500
);
assertThat
(
response
.
getStatus
()).
isEqualTo
(
500
);
}
}
...
@@ -103,7 +103,7 @@ class HttpRestartServerTests {
...
@@ -103,7 +103,7 @@ class HttpRestartServerTests {
MockHttpServletResponse
response
=
new
MockHttpServletResponse
();
MockHttpServletResponse
response
=
new
MockHttpServletResponse
();
request
.
setContent
(
new
byte
[]
{
0
,
0
,
0
});
request
.
setContent
(
new
byte
[]
{
0
,
0
,
0
});
this
.
server
.
handle
(
new
ServletServerHttpRequest
(
request
),
new
ServletServerHttpResponse
(
response
));
this
.
server
.
handle
(
new
ServletServerHttpRequest
(
request
),
new
ServletServerHttpResponse
(
response
));
verify
Zer
oInteractions
(
this
.
delegate
);
verify
N
oInteractions
(
this
.
delegate
);
assertThat
(
response
.
getStatus
()).
isEqualTo
(
500
);
assertThat
(
response
.
getStatus
()).
isEqualTo
(
500
);
}
}
...
...
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizerFactoryTests.java
View file @
8ecdf919
...
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatExceptionOfType
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatExceptionOfType
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link PropertyMappingContextCustomizerFactory}.
* Tests for {@link PropertyMappingContextCustomizerFactory}.
...
@@ -53,7 +53,7 @@ class PropertyMappingContextCustomizerFactoryTests {
...
@@ -53,7 +53,7 @@ class PropertyMappingContextCustomizerFactoryTests {
given
(
context
.
getEnvironment
()).
willReturn
(
environment
);
given
(
context
.
getEnvironment
()).
willReturn
(
environment
);
given
(
context
.
getBeanFactory
()).
willReturn
(
beanFactory
);
given
(
context
.
getBeanFactory
()).
willReturn
(
beanFactory
);
customizer
.
customizeContext
(
context
,
null
);
customizer
.
customizeContext
(
context
,
null
);
verify
Zer
oInteractions
(
environment
);
verify
N
oInteractions
(
environment
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringBootExceptionHandlerTests.java
View file @
8ecdf919
...
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
...
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link SpringBootExceptionHandler}.
* Tests for {@link SpringBootExceptionHandler}.
...
@@ -43,7 +43,7 @@ class SpringBootExceptionHandlerTests {
...
@@ -43,7 +43,7 @@ class SpringBootExceptionHandlerTests {
Exception
ex
=
new
Exception
();
Exception
ex
=
new
Exception
();
this
.
handler
.
registerLoggedException
(
ex
);
this
.
handler
.
registerLoggedException
(
ex
);
this
.
handler
.
uncaughtException
(
thread
,
ex
);
this
.
handler
.
uncaughtException
(
thread
,
ex
);
verify
Zer
oInteractions
(
this
.
parent
);
verify
N
oInteractions
(
this
.
parent
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BindResultTests.java
View file @
8ecdf919
...
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
...
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatIllegalArgumentException
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatIllegalArgumentException
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link BindResult}.
* Tests for {@link BindResult}.
...
@@ -100,7 +100,7 @@ class BindResultTests {
...
@@ -100,7 +100,7 @@ class BindResultTests {
void
ifBoundWhenHasNoValueShouldNotCallConsumer
()
{
void
ifBoundWhenHasNoValueShouldNotCallConsumer
()
{
BindResult
<
String
>
result
=
BindResult
.
of
(
null
);
BindResult
<
String
>
result
=
BindResult
.
of
(
null
);
result
.
ifBound
(
this
.
consumer
);
result
.
ifBound
(
this
.
consumer
);
verify
Zer
oInteractions
(
this
.
consumer
);
verify
N
oInteractions
(
this
.
consumer
);
}
}
@Test
@Test
...
@@ -121,7 +121,7 @@ class BindResultTests {
...
@@ -121,7 +121,7 @@ class BindResultTests {
void
mapWhenHasNoValueShouldNotCallMapper
()
{
void
mapWhenHasNoValueShouldNotCallMapper
()
{
BindResult
<
String
>
result
=
BindResult
.
of
(
null
);
BindResult
<
String
>
result
=
BindResult
.
of
(
null
);
result
.
map
(
this
.
mapper
);
result
.
map
(
this
.
mapper
);
verify
Zer
oInteractions
(
this
.
mapper
);
verify
N
oInteractions
(
this
.
mapper
);
}
}
@Test
@Test
...
@@ -140,7 +140,7 @@ class BindResultTests {
...
@@ -140,7 +140,7 @@ class BindResultTests {
void
orElseGetWhenHasValueShouldReturnValue
()
{
void
orElseGetWhenHasValueShouldReturnValue
()
{
BindResult
<
String
>
result
=
BindResult
.
of
(
"foo"
);
BindResult
<
String
>
result
=
BindResult
.
of
(
"foo"
);
assertThat
(
result
.
orElseGet
(
this
.
supplier
)).
isEqualTo
(
"foo"
);
assertThat
(
result
.
orElseGet
(
this
.
supplier
)).
isEqualTo
(
"foo"
);
verify
Zer
oInteractions
(
this
.
supplier
);
verify
N
oInteractions
(
this
.
supplier
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/DeferredLogTests.java
View file @
8ecdf919
...
@@ -26,8 +26,8 @@ import org.springframework.test.util.ReflectionTestUtils;
...
@@ -26,8 +26,8 @@ import org.springframework.test.util.ReflectionTestUtils;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verifyNoInteractions
;
import
static
org
.
mockito
.
Mockito
.
verifyNoMoreInteractions
;
import
static
org
.
mockito
.
Mockito
.
verifyNoMoreInteractions
;
import
static
org
.
mockito
.
Mockito
.
verifyZeroInteractions
;
/**
/**
* Tests for {@link DeferredLog}.
* Tests for {@link DeferredLog}.
...
@@ -168,7 +168,7 @@ class DeferredLogTests {
...
@@ -168,7 +168,7 @@ class DeferredLogTests {
verify
(
this
.
log
).
info
(
"1"
,
null
);
verify
(
this
.
log
).
info
(
"1"
,
null
);
verify
(
this
.
log
).
fatal
(
"2"
,
null
);
verify
(
this
.
log
).
fatal
(
"2"
,
null
);
verifyNoMoreInteractions
(
this
.
log
);
verifyNoMoreInteractions
(
this
.
log
);
verify
Zer
oInteractions
(
log2
);
verify
N
oInteractions
(
log2
);
}
}
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskExecutorBuilderTests.java
View file @
8ecdf919
...
@@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
...
@@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link TaskExecutorBuilder}.
* Tests for {@link TaskExecutorBuilder}.
...
@@ -125,7 +125,7 @@ class TaskExecutorBuilderTests {
...
@@ -125,7 +125,7 @@ class TaskExecutorBuilderTests {
TaskExecutorCustomizer
customizer2
=
mock
(
TaskExecutorCustomizer
.
class
);
TaskExecutorCustomizer
customizer2
=
mock
(
TaskExecutorCustomizer
.
class
);
ThreadPoolTaskExecutor
executor
=
this
.
builder
.
customizers
(
customizer1
)
ThreadPoolTaskExecutor
executor
=
this
.
builder
.
customizers
(
customizer1
)
.
customizers
(
Collections
.
singleton
(
customizer2
)).
build
();
.
customizers
(
Collections
.
singleton
(
customizer2
)).
build
();
verify
Zer
oInteractions
(
customizer1
);
verify
N
oInteractions
(
customizer1
);
verify
(
customizer2
).
customize
(
executor
);
verify
(
customizer2
).
customize
(
executor
);
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/task/TaskSchedulerBuilderTests.java
View file @
8ecdf919
...
@@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
...
@@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link TaskSchedulerBuilder}.
* Tests for {@link TaskSchedulerBuilder}.
...
@@ -101,7 +101,7 @@ class TaskSchedulerBuilderTests {
...
@@ -101,7 +101,7 @@ class TaskSchedulerBuilderTests {
TaskSchedulerCustomizer
customizer2
=
mock
(
TaskSchedulerCustomizer
.
class
);
TaskSchedulerCustomizer
customizer2
=
mock
(
TaskSchedulerCustomizer
.
class
);
ThreadPoolTaskScheduler
scheduler
=
this
.
builder
.
customizers
(
customizer1
)
ThreadPoolTaskScheduler
scheduler
=
this
.
builder
.
customizers
(
customizer1
)
.
customizers
(
Collections
.
singleton
(
customizer2
)).
build
();
.
customizers
(
Collections
.
singleton
(
customizer2
)).
build
();
verify
Zer
oInteractions
(
customizer1
);
verify
N
oInteractions
(
customizer1
);
verify
(
customizer2
).
customize
(
scheduler
);
verify
(
customizer2
).
customize
(
scheduler
);
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/util/LambdaSafeTests.java
View file @
8ecdf919
...
@@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.contains;
...
@@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.contains;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
BDDMockito
.
given
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link LambdaSafe}.
* Tests for {@link LambdaSafe}.
...
@@ -88,7 +88,7 @@ class LambdaSafeTests {
...
@@ -88,7 +88,7 @@ class LambdaSafeTests {
GenericCallback
<?>
callbackInstance
=
mock
(
StringBuilderCallback
.
class
);
GenericCallback
<?>
callbackInstance
=
mock
(
StringBuilderCallback
.
class
);
String
argument
=
"foo"
;
String
argument
=
"foo"
;
LambdaSafe
.
callback
(
GenericCallback
.
class
,
callbackInstance
,
argument
).
invoke
((
c
)
->
c
.
handle
(
argument
));
LambdaSafe
.
callback
(
GenericCallback
.
class
,
callbackInstance
,
argument
).
invoke
((
c
)
->
c
.
handle
(
argument
));
verify
Zer
oInteractions
(
callbackInstance
);
verify
N
oInteractions
(
callbackInstance
);
}
}
@Test
@Test
...
@@ -164,7 +164,7 @@ class LambdaSafeTests {
...
@@ -164,7 +164,7 @@ class LambdaSafeTests {
InvocationResult
<
Integer
>
result
=
LambdaSafe
.
callback
(
GenericFactory
.
class
,
callbackInstance
,
argument
)
InvocationResult
<
Integer
>
result
=
LambdaSafe
.
callback
(
GenericFactory
.
class
,
callbackInstance
,
argument
)
.
invokeAnd
((
c
)
->
c
.
handle
(
argument
));
.
invokeAnd
((
c
)
->
c
.
handle
(
argument
));
assertThat
(
result
.
hasResult
()).
isFalse
();
assertThat
(
result
.
hasResult
()).
isFalse
();
verify
Zer
oInteractions
(
callbackInstance
);
verify
N
oInteractions
(
callbackInstance
);
}
}
@Test
@Test
...
@@ -229,7 +229,7 @@ class LambdaSafeTests {
...
@@ -229,7 +229,7 @@ class LambdaSafeTests {
String
argument
=
"foo"
;
String
argument
=
"foo"
;
LambdaSafe
.
callbacks
(
GenericCallback
.
class
,
Collections
.
singleton
(
callbackInstance
),
argument
)
LambdaSafe
.
callbacks
(
GenericCallback
.
class
,
Collections
.
singleton
(
callbackInstance
),
argument
)
.
invoke
((
c
)
->
c
.
handle
(
null
));
.
invoke
((
c
)
->
c
.
handle
(
null
));
verify
Zer
oInteractions
(
callbackInstance
);
verify
N
oInteractions
(
callbackInstance
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java
View file @
8ecdf919
...
@@ -62,7 +62,7 @@ import static org.mockito.Mockito.inOrder;
...
@@ -62,7 +62,7 @@ import static org.mockito.Mockito.inOrder;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
import
static
org
.
springframework
.
test
.
web
.
client
.
match
.
MockRestRequestMatchers
.
requestTo
;
import
static
org
.
springframework
.
test
.
web
.
client
.
match
.
MockRestRequestMatchers
.
requestTo
;
import
static
org
.
springframework
.
test
.
web
.
client
.
response
.
MockRestResponseCreators
.
withSuccess
;
import
static
org
.
springframework
.
test
.
web
.
client
.
response
.
MockRestResponseCreators
.
withSuccess
;
...
@@ -391,7 +391,7 @@ class RestTemplateBuilderTests {
...
@@ -391,7 +391,7 @@ class RestTemplateBuilderTests {
RestTemplateCustomizer
customizer2
=
mock
(
RestTemplateCustomizer
.
class
);
RestTemplateCustomizer
customizer2
=
mock
(
RestTemplateCustomizer
.
class
);
RestTemplate
template
=
this
.
builder
.
customizers
(
customizer1
).
customizers
(
Collections
.
singleton
(
customizer2
))
RestTemplate
template
=
this
.
builder
.
customizers
(
customizer1
).
customizers
(
Collections
.
singleton
(
customizer2
))
.
build
();
.
build
();
verify
Zer
oInteractions
(
customizer1
);
verify
N
oInteractions
(
customizer1
);
verify
(
customizer2
).
customize
(
template
);
verify
(
customizer2
).
customize
(
template
);
}
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilderTests.java
View file @
8ecdf919
...
@@ -47,7 +47,7 @@ import static org.mockito.ArgumentMatchers.any;
...
@@ -47,7 +47,7 @@ import static org.mockito.ArgumentMatchers.any;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
verify
Zer
oInteractions
;
import
static
org
.
mockito
.
Mockito
.
verify
N
oInteractions
;
/**
/**
* Tests for {@link WebServiceTemplateBuilder}.
* Tests for {@link WebServiceTemplateBuilder}.
...
@@ -241,7 +241,7 @@ class WebServiceTemplateBuilderTests {
...
@@ -241,7 +241,7 @@ class WebServiceTemplateBuilderTests {
WebServiceTemplateCustomizer
customizer2
=
mock
(
WebServiceTemplateCustomizer
.
class
);
WebServiceTemplateCustomizer
customizer2
=
mock
(
WebServiceTemplateCustomizer
.
class
);
WebServiceTemplate
template
=
this
.
builder
.
customizers
(
customizer1
)
WebServiceTemplate
template
=
this
.
builder
.
customizers
(
customizer1
)
.
customizers
(
Collections
.
singleton
(
customizer2
)).
build
();
.
customizers
(
Collections
.
singleton
(
customizer2
)).
build
();
verify
Zer
oInteractions
(
customizer1
);
verify
N
oInteractions
(
customizer1
);
verify
(
customizer2
).
customize
(
template
);
verify
(
customizer2
).
customize
(
template
);
}
}
...
...
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