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
d7fcec1a
Commit
d7fcec1a
authored
Jul 10, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the use of a bean override form SampleKafkaApplicationTests
See gh-13609
parent
8cc0d557
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
26 deletions
+5
-26
SampleKafkaApplicationTests.java
...c/test/java/sample/kafka/SampleKafkaApplicationTests.java
+5
-26
No files found.
spring-boot-samples/spring-boot-sample-kafka/src/test/java/sample/kafka/SampleKafkaApplicationTests.java
View file @
d7fcec1a
...
...
@@ -15,17 +15,12 @@
*/
package
sample
.
kafka
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.concurrent.TimeUnit
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.TestConfiguration
;
import
org.springframework.boot.test.rule.OutputCapture
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.kafka.test.context.EmbeddedKafka
;
import
org.springframework.test.context.junit4.SpringRunner
;
...
...
@@ -43,34 +38,18 @@ import static org.assertj.core.api.Assertions.assertThat;
@EmbeddedKafka
public
class
SampleKafkaApplicationTests
{
private
static
final
CountDownLatch
latch
=
new
CountDownLatch
(
1
);
@Rule
public
OutputCapture
outputCapture
=
new
OutputCapture
();
@Test
public
void
testVanillaExchange
()
throws
Exception
{
assertThat
(
latch
.
await
(
10
,
TimeUnit
.
SECONDS
)).
isTrue
();
long
end
=
System
.
currentTimeMillis
()
+
10000
;
while
(!
this
.
outputCapture
.
toString
().
contains
(
"A simple test message"
)
&&
System
.
currentTimeMillis
()
<
end
)
{
Thread
.
sleep
(
250
);
}
assertThat
(
this
.
outputCapture
.
toString
().
contains
(
"A simple test message"
))
.
isTrue
();
}
@TestConfiguration
public
static
class
Config
{
@Bean
public
Consumer
consumer
()
{
return
new
Consumer
()
{
@Override
public
void
processMessage
(
SampleMessage
message
)
{
super
.
processMessage
(
message
);
latch
.
countDown
();
}
};
}
}
}
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