-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestBug.java
52 lines (39 loc) · 1.4 KB
/
TestBug.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.example;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class TestBug {
private static final String ID2 = "id2";
private static final String ID1 = "id1";
@Autowired
public TestDocumentRepository repository;
@BeforeEach
public void setUp() {
List<TestDocument> documents =
Arrays.asList(new TestDocument(ID1, "value1"), new TestDocument(ID2, "value2"));
repository.deleteAll()
.thenMany(repository.saveAll(documents))
.blockLast();
}
@Test
void test() {
// How to reproduce:
// 1. Start Elasticsearch
// 2. Run the test, it should fail as two documents exist
// 3. Set a breakpoint in the next line
// 4. Run the test in debug mode
// 5. Once it's paused in the breakpoint stop Elasticsearch
// 6. Resume the execution
// 7. The test should pass because the error was silenced
List<TestDocument> documents = repository.findAllById(Arrays.asList(ID1, ID2))
.collectList()
.block();
assertThat(documents, hasSize(0));
}
}