22
22
import java .util .Arrays ;
23
23
import java .util .List ;
24
24
25
- import org .junit .Before ;
26
- import org .junit .Test ;
27
- import org .junit .runner .RunWith ;
28
-
25
+ import org .junit .jupiter .api .BeforeEach ;
26
+ import org .junit .jupiter .api .Test ;
27
+ import org .junit .jupiter .api .condition .DisabledForJreRange ;
28
+ import org .junit .jupiter .api .condition .JRE ;
29
+ import org .junit .jupiter .api .extension .ExtendWith ;
29
30
import org .springframework .beans .factory .annotation .Autowired ;
30
31
import org .springframework .data .mongodb .core .MongoOperations ;
31
32
import org .springframework .test .context .ContextConfiguration ;
32
- import org .springframework .test .context .junit4 . SpringRunner ;
33
+ import org .springframework .test .context .junit . jupiter . SpringExtension ;
33
34
34
35
/**
35
36
* Integration test for {@link PersonRepository} for lazy loading support.
38
39
* @author Oliver Gierke
39
40
*/
40
41
@ ContextConfiguration (locations = "PersonRepositoryIntegrationTests-context.xml" )
41
- @ RunWith ( SpringRunner .class )
42
+ @ ExtendWith ( SpringExtension .class )
42
43
public class PersonRepositoryLazyLoadingIntegrationTests {
43
44
44
45
@ Autowired PersonRepository repository ;
45
46
@ Autowired MongoOperations operations ;
46
47
47
- @ Before
48
+ @ BeforeEach
48
49
public void setUp () throws InterruptedException {
49
50
50
51
repository .deleteAll ();
@@ -61,7 +62,6 @@ public void shouldLoadAssociationWithDbRefOnInterfaceAndLazyLoadingEnabled() thr
61
62
Person person = new Person ();
62
63
person .setFirstname ("Oliver" );
63
64
person .setFans (Arrays .asList (thomas ));
64
- person .setRealFans (new ArrayList <User >(Arrays .asList (thomas )));
65
65
repository .save (person );
66
66
67
67
Person oliver = repository .findById (person .id ).get ();
@@ -75,15 +75,15 @@ public void shouldLoadAssociationWithDbRefOnInterfaceAndLazyLoadingEnabled() thr
75
75
}
76
76
77
77
@ Test // DATAMONGO-348
78
- public void shouldLoadAssociationWithDbRefOnConcreteCollectionAndLazyLoadingEnabled () throws Exception {
78
+ @ DisabledForJreRange (min = JRE .JAVA_16 , disabledReason = "Class Proxies for eg. ArrayList require to open java.util." )
79
+ public void shouldLoadAssociationWithDbRefOnConcreteCollectionAndLazyLoadingEnabled () {
79
80
80
81
User thomas = new User ();
81
82
thomas .username = "Thomas" ;
82
83
operations .save (thomas );
83
84
84
85
Person person = new Person ();
85
86
person .setFirstname ("Oliver" );
86
- person .setFans (Arrays .asList (thomas ));
87
87
person .setRealFans (new ArrayList <User >(Arrays .asList (thomas )));
88
88
repository .save (person );
89
89
0 commit comments