1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.richclient.application.support;
17
18 import org.easymock.EasyMock;
19
20 import org.springframework.richclient.test.SpringRichTestCase;
21 import org.springframework.richclient.application.PageListener;
22 import org.springframework.richclient.application.ApplicationWindow;
23 import org.springframework.richclient.application.config.ApplicationLifecycleAdvisor;
24 import org.springframework.richclient.application.config.DefaultApplicationLifecycleAdvisor;
25 import org.springframework.richclient.application.config.ApplicationWindowConfigurer;
26 import org.springframework.richclient.command.CommandGroup;
27
28
29
30
31
32
33 public class DefaultApplicationWindowTests extends SpringRichTestCase {
34
35 public void testRegressionFailureToRemovePageListener() {
36 PageListener pageListener = (PageListener)EasyMock.createNiceMock(PageListener.class);
37 EasyMock.replay(pageListener);
38 DefaultApplicationWindow daw = new DefaultApplicationWindow();
39 daw.addPageListener(pageListener);
40
41 try {
42 daw.removePageListener(pageListener);
43 } catch(IllegalArgumentException iae) {
44 iae.printStackTrace();
45 fail("DefaultApplicationWindow.removePageListener threw IllegalArgumentException when removing a valid pageListener: " + iae);
46 }
47 }
48
49
50
51
52
53
54
55
56
57 protected ApplicationLifecycleAdvisor createApplicationLifecycleAdvisor() {
58 return new DefaultApplicationLifecycleAdvisor() {
59 public void onPreWindowOpen(ApplicationWindowConfigurer configurer) {
60 }
61 public void onCommandsCreated(ApplicationWindow window) {
62 }
63 public ApplicationWindowCommandManager createWindowCommandManager() {
64 return null;
65 }
66 public CommandGroup getMenuBarCommandGroup() {
67 return null;
68 }
69 public CommandGroup getToolBarCommandGroup() {
70 return null;
71 }
72 };
73 }
74 }