2323import java .util .Objects ;
2424
2525import org .bson .Document ;
26- import org .junit .Before ;
27- import org .junit .Test ;
28- import org .junit .runner .RunWith ;
26+ import org .junit .jupiter .api .BeforeEach ;
27+ import org .junit .jupiter .api .Test ;
28+ import org .junit .jupiter .api .extension .ExtendWith ;
29+
2930import org .springframework .beans .factory .annotation .Autowired ;
3031import org .springframework .beans .factory .annotation .Qualifier ;
3132import org .springframework .dao .DataAccessException ;
3233import org .springframework .data .annotation .Id ;
3334import org .springframework .test .context .ContextConfiguration ;
34- import org .springframework .test .context .junit4 . SpringRunner ;
35+ import org .springframework .test .context .junit . jupiter . SpringExtension ;
3536
3637import com .mongodb .MongoException ;
3738import com .mongodb .client .MongoCollection ;
4748 * @author Thomas Risberg
4849 * @author Mark Paluch
4950 */
50- @ RunWith ( SpringRunner .class )
51+ @ ExtendWith ( SpringExtension .class )
5152@ ContextConfiguration ("classpath:template-mapping.xml" )
52- public class MongoTemplateMappingTests {
53+ class MongoTemplateMappingTests {
5354
5455 @ Autowired @ Qualifier ("mongoTemplate1" ) MongoTemplate template1 ;
5556
5657 @ Autowired @ Qualifier ("mongoTemplate2" ) MongoTemplate template2 ;
5758
58- @ Before
59- public void setUp () {
60- template1 .dropCollection (template1 . getCollectionName ( Person . class ) );
59+ @ BeforeEach
60+ void setUp () {
61+ template1 .dropCollection ("person" );
6162 }
6263
6364 @ Test
64- public void insertsEntityCorrectly1 () {
65+ void insertsEntityCorrectly1 () {
6566
6667 addAndRetrievePerson (template1 );
6768 checkPersonPersisted (template1 );
6869 }
6970
7071 @ Test
71- public void insertsEntityCorrectly2 () {
72+ void insertsEntityCorrectly2 () {
7273
7374 addAndRetrievePerson (template2 );
7475 checkPersonPersisted (template2 );
7576 }
7677
7778 @ Test // DATAMONGO-2357
78- public void writesAndReadsEntityWithNativeMongoGeoJsonTypesCorrectly () {
79+ void writesAndReadsEntityWithNativeMongoGeoJsonTypesCorrectly () {
7980
8081 WithMongoGeoJson source = new WithMongoGeoJson ();
8182 source .id = "id-2" ;
@@ -88,7 +89,7 @@ public void writesAndReadsEntityWithNativeMongoGeoJsonTypesCorrectly() {
8889 }
8990
9091 @ Test // DATAMONGO-2357
91- public void writesAndReadsEntityWithOpenNativeMongoGeoJsonTypesCorrectly () {
92+ void writesAndReadsEntityWithOpenNativeMongoGeoJsonTypesCorrectly () {
9293
9394 WithOpenMongoGeoJson source = new WithOpenMongoGeoJson ();
9495 source .id = "id-2" ;
@@ -109,7 +110,7 @@ public String getId() {
109110 return this .id ;
110111 }
111112
112- public MultiPolygon getMultiPolygon () {
113+ MultiPolygon getMultiPolygon () {
113114 return this .multiPolygon ;
114115 }
115116
@@ -149,13 +150,13 @@ static class WithOpenMongoGeoJson {
149150 @ Id String id ;
150151 Geometry geometry ;
151152
152- public WithOpenMongoGeoJson () {}
153+ WithOpenMongoGeoJson () {}
153154
154155 public String getId () {
155156 return this .id ;
156157 }
157158
158- public Geometry getGeometry () {
159+ Geometry getGeometry () {
159160 return this .geometry ;
160161 }
161162
0 commit comments