Skip to content

Commit ed783de

Browse files
author
Micha Kiener
committed
SPR-6416, tests
1 parent c2241ad commit ed783de

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

org.springframework.context/src/test/java/org/springframework/conversation/BasicConversationTests.java

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import static org.junit.Assert.*;
1919

20-
import org.junit.Before;
20+
import org.junit.BeforeClass;
2121
import org.junit.Test;
2222
import org.springframework.context.ConfigurableApplicationContext;
2323
import org.springframework.context.support.GenericXmlApplicationContext;
@@ -32,29 +32,28 @@
3232
* @since 3.1
3333
*/
3434
public class BasicConversationTests {
35-
private ConfigurableApplicationContext ctx;
36-
private ConversationManager manager;
37-
private ConversationStore store;
38-
private ConversationResolver resolver;
35+
private static ConfigurableApplicationContext context;
36+
private static ConversationManager manager;
37+
private static ConversationStore store;
38+
private static ConversationResolver resolver;
3939

40-
@Before
41-
public void setUp() {
42-
ctx = loadContext(getContextLocation());
43-
manager = ctx.getBean(ConversationManager.class);
44-
store = ctx.getBean(ConversationStore.class);
45-
resolver = ctx.getBean(ConversationResolver.class);
40+
@BeforeClass
41+
public static void setUp() {
42+
context = loadContext(getContextLocation());
43+
manager = context.getBean(ConversationManager.class);
44+
store = context.getBean(ConversationStore.class);
45+
resolver = context.getBean(ConversationResolver.class);
4646
}
4747

4848
@Test
4949
public void testContext() {
50-
ConfigurableApplicationContext context = getContext();
5150
assertNotNull(context);
5251
assertNotNull(manager);
5352
}
5453

5554
@Test
5655
public void testTemporaryConversation() {
57-
ConversationalBean bean = (ConversationalBean) getContext().getBean("testBean");
56+
ConversationalBean bean = (ConversationalBean) context.getBean("testBean");
5857
assertNotNull(bean);
5958
assertNull(bean.getName());
6059
String id = resolver.getCurrentConversationId();
@@ -71,16 +70,11 @@ public void testTemporaryConversation() {
7170
assertNull(resolver.getCurrentConversationId());
7271
}
7372

74-
protected String getContextLocation() {
73+
protected static String getContextLocation() {
7574
return "org/springframework/conversation/conversationTestContext.xml";
7675
}
7776

78-
protected ConfigurableApplicationContext loadContext(String configLocation) {
79-
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(getContextLocation());
80-
return ctx;
81-
}
82-
83-
protected ConfigurableApplicationContext getContext() {
84-
return ctx;
77+
protected static ConfigurableApplicationContext loadContext(String configLocation) {
78+
return new GenericXmlApplicationContext(getContextLocation());
8579
}
8680
}

0 commit comments

Comments
 (0)