15
15
*/
16
16
package org .springframework .hateoas .core ;
17
17
18
- import static org .hamcrest .CoreMatchers .*;
19
- import static org .junit .Assert .*;
20
-
21
18
import org .junit .Rule ;
22
19
import org .junit .Test ;
23
20
import org .junit .rules .ExpectedException ;
24
21
import org .springframework .beans .factory .support .DefaultListableBeanFactory ;
25
22
import org .springframework .beans .factory .support .RootBeanDefinition ;
26
- import org .springframework .context .ApplicationContext ;
27
23
import org .springframework .context .support .GenericApplicationContext ;
28
24
import org .springframework .hateoas .core .ControllerEntityLinksUnitTest .Person ;
29
25
import org .springframework .hateoas .core .ControllerEntityLinksUnitTest .SampleController ;
30
26
import org .springframework .hateoas .mvc .ControllerLinkBuilderFactory ;
31
27
import org .springframework .stereotype .Controller ;
32
28
29
+ import static org .hamcrest .CoreMatchers .*;
30
+ import static org .junit .Assert .*;
31
+
33
32
/**
34
33
* Unit tests for {@link ControllerEntityLinksFactoryBean}.
35
- *
34
+ *
36
35
* @author Oliver Gierke
37
36
*/
38
37
public class ControllerEntityLinksFactoryBeanUnitTest {
@@ -56,12 +55,13 @@ public void discoversSampleControllerFromApplicationContext() throws Exception {
56
55
DefaultListableBeanFactory factory = new DefaultListableBeanFactory ();
57
56
factory .registerBeanDefinition ("controller" , new RootBeanDefinition (SampleController .class ));
58
57
59
- ApplicationContext context = new GenericApplicationContext (factory );
58
+ GenericApplicationContext context = new GenericApplicationContext (factory );
60
59
61
60
ControllerEntityLinksFactoryBean builder = new ControllerEntityLinksFactoryBean ();
62
61
builder .setAnnotation (Controller .class );
63
62
builder .setLinkBuilderFactory (new ControllerLinkBuilderFactory ());
64
63
builder .setApplicationContext (context );
64
+ context .refresh ();
65
65
builder .afterPropertiesSet ();
66
66
67
67
ControllerEntityLinks entityLinks = builder .getObject ();
0 commit comments