Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TousAntiCovid sources
Cléa Server
Commits
ab338103
Commit
ab338103
authored
Apr 20, 2021
by
Ananas Orange
Browse files
Fixed SpyBean not working with RefreshScope
parent
9ad881ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
clea-venue-consumer/src/test/java/fr/gouv/clea/consumer/service/impl/ConsumerServiceTest.java
View file @
ab338103
package
fr.gouv.clea.consumer.service.impl
;
import
fr.gouv.clea.consumer.model.DecodedVisit
;
import
fr.gouv.clea.consumer.service.I
Consumer
Service
;
import
fr.gouv.clea.consumer.service.I
DecodedVisit
Service
;
import
fr.gouv.clea.consumer.utils.KafkaSerializer
;
import
fr.inria.clea.lsp.EncryptedLocationSpecificPart
;
import
org.apache.commons.lang3.RandomUtils
;
...
...
@@ -44,8 +44,12 @@ class ConsumerServiceTest {
@Autowired
private
EmbeddedKafkaBroker
embeddedKafkaBroker
;
/*
* @RefreshScope beans cannot be spied with @SpyBean
* see https://github.com/spring-cloud/spring-cloud-config/issues/944
*/
@SpyBean
private
I
ConsumerService
consumer
Service
;
private
I
DecodedVisitService
decodedVisit
Service
;
private
Producer
<
String
,
DecodedVisit
>
producer
;
...
...
@@ -62,7 +66,7 @@ class ConsumerServiceTest {
@Test
@DisplayName
(
"test that kafka listener triggers when something is sent to the queue"
)
void
testCanConsumeMessageSent
i
nDefaultQueue
()
{
void
testCanConsumeMessageSent
I
nDefaultQueue
()
{
DecodedVisit
decodedVisit
=
new
DecodedVisit
(
Instant
.
now
(),
EncryptedLocationSpecificPart
.
builder
()
...
...
@@ -79,8 +83,8 @@ class ConsumerServiceTest {
await
().
atMost
(
30
,
TimeUnit
.
SECONDS
)
.
untilAsserted
(
()
->
verify
(
consumer
Service
,
times
(
1
))
.
consum
e
(
any
(
DecodedVisit
.
class
))
()
->
verify
(
decodedVisit
Service
,
times
(
1
))
.
decryptAndValidat
e
(
any
(
DecodedVisit
.
class
))
);
}
}
\ No newline at end of file
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