|
26 | 26 | import java.util.Locale;
|
27 | 27 | import java.util.Optional;
|
28 | 28 |
|
29 |
| -import org.junit.Before; |
30 |
| -import org.junit.Test; |
31 |
| -import org.junit.runner.RunWith; |
| 29 | +import org.junit.jupiter.api.BeforeEach; |
| 30 | +import org.junit.jupiter.api.Test; |
32 | 31 | import org.springframework.beans.factory.annotation.Autowired;
|
| 32 | +import org.springframework.context.annotation.Configuration; |
| 33 | +import org.springframework.context.annotation.Import; |
33 | 34 | import org.springframework.data.annotation.Id;
|
34 | 35 | import org.springframework.data.elasticsearch.annotations.Document;
|
35 | 36 | import org.springframework.data.elasticsearch.annotations.GeoPointField;
|
36 | 37 | import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
|
37 | 38 | import org.springframework.data.elasticsearch.core.geo.GeoPoint;
|
| 39 | +import org.springframework.data.elasticsearch.junit.jupiter.ElasticsearchTemplateConfiguration; |
| 40 | +import org.springframework.data.elasticsearch.junit.jupiter.SpringIntegrationTest; |
38 | 41 | import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
| 42 | +import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; |
39 | 43 | import org.springframework.data.elasticsearch.utils.IndexInitializer;
|
40 | 44 | import org.springframework.data.geo.Box;
|
41 | 45 | import org.springframework.data.geo.Circle;
|
42 | 46 | import org.springframework.data.geo.Point;
|
43 | 47 | import org.springframework.data.geo.Polygon;
|
44 | 48 | import org.springframework.test.context.ContextConfiguration;
|
45 |
| -import org.springframework.test.context.junit4.SpringRunner; |
46 | 49 |
|
47 | 50 | /**
|
48 | 51 | * @author Mark Paluch
|
49 | 52 | * @author Christoph Strobl
|
50 | 53 | * @author Peter-Josef Meisch
|
51 | 54 | */
|
52 |
| -@RunWith(SpringRunner.class) |
53 |
| -@ContextConfiguration("classpath:/repository-spring-data-geo-support.xml") |
| 55 | +@SpringIntegrationTest |
| 56 | +@ContextConfiguration(classes = { SpringDataGeoRepositoryTests.Config.class }) |
54 | 57 | public class SpringDataGeoRepositoryTests {
|
55 | 58 |
|
| 59 | + @Configuration |
| 60 | + @Import({ ElasticsearchTemplateConfiguration.class }) |
| 61 | + @EnableElasticsearchRepositories(basePackages = { "org.springframework.data.elasticsearch.repositories.geo" }, |
| 62 | + considerNestedRepositories = true) |
| 63 | + static class Config {} |
| 64 | + |
56 | 65 | @Autowired ElasticsearchTemplate template;
|
57 | 66 |
|
58 | 67 | @Autowired SpringDataGeoRepository repository;
|
59 | 68 |
|
60 |
| - @Before |
| 69 | + @BeforeEach |
61 | 70 | public void init() {
|
62 | 71 | IndexInitializer.init(template, GeoEntity.class);
|
63 | 72 | }
|
|
0 commit comments