diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-08-30 16:24:18 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-08-31 11:06:45 +0300 |
commit | 1921394b57526d04059d9768e4162405c63d853b (patch) | |
tree | 493201e367d69e9fba8dfa072591c5e7caf8cc6f /server/tests | |
parent | 7b25b3886ea95bc6495506fbe9472e45fcbde684 (diff) | |
download | vaadin-framework-1921394b57526d04059d9768e4162405c63d853b.tar.gz vaadin-framework-1921394b57526d04059d9768e4162405c63d853b.zip |
Rename FragmentManager to NavigationStateManager (#9367)
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java | 60 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java | 6 |
2 files changed, 33 insertions, 33 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java b/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java index 595ddb95db..5bde04a3b4 100644 --- a/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java +++ b/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java @@ -23,7 +23,7 @@ import junit.framework.TestCase; import org.easymock.EasyMock; import org.easymock.IMocksControl; -import com.vaadin.navigator.FragmentManager; +import com.vaadin.navigator.NavigationStateManager; import com.vaadin.navigator.Navigator; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener; @@ -45,14 +45,14 @@ public class NavigatorTest extends TestCase { } } - public static class NullFragmentManager implements FragmentManager { + public static class NullFragmentManager implements NavigationStateManager { @Override - public String getFragment() { + public String getState() { return null; } @Override - public void setFragment(String fragment) { + public void setState(String fragment) { // do nothing } } @@ -171,7 +171,7 @@ public class NavigatorTest extends TestCase { public void testBasicNavigation() { IMocksControl control = EasyMock.createControl(); - FragmentManager manager = control.createMock(FragmentManager.class); + NavigationStateManager manager = control.createMock(NavigationStateManager.class); ViewDisplay display = control.createMock(ViewDisplay.class); ViewProvider provider = control.createMock(ViewProvider.class); View view1 = control.createMock(View.class); @@ -180,25 +180,25 @@ public class NavigatorTest extends TestCase { // prepare mocks: what to expect EasyMock.expect(provider.getViewName("test1")).andReturn("test1"); EasyMock.expect(provider.getView("test1")).andReturn(view1); - EasyMock.expect(manager.getFragment()).andReturn(""); + EasyMock.expect(manager.getState()).andReturn(""); view1.navigateTo(""); display.showView(view1); - manager.setFragment("test1"); + manager.setState("test1"); EasyMock.expect(provider.getViewName("test2/")).andReturn("test2"); EasyMock.expect(provider.getView("test2")).andReturn(view2); - EasyMock.expect(manager.getFragment()).andReturn("view1"); + EasyMock.expect(manager.getState()).andReturn("view1"); view2.navigateTo(""); display.showView(view2); - manager.setFragment("test2"); + manager.setState("test2"); EasyMock.expect(provider.getViewName("test1/params")) .andReturn("test1"); EasyMock.expect(provider.getView("test1")).andReturn(view1); - EasyMock.expect(manager.getFragment()).andReturn("view2"); + EasyMock.expect(manager.getState()).andReturn("view2"); view1.navigateTo("params"); display.showView(view1); - manager.setFragment("test1/params"); + manager.setState("test1/params"); control.replay(); @@ -213,7 +213,7 @@ public class NavigatorTest extends TestCase { public void testMainView() { IMocksControl control = EasyMock.createControl(); - FragmentManager manager = control.createMock(FragmentManager.class); + NavigationStateManager manager = control.createMock(NavigationStateManager.class); ViewDisplay display = control.createMock(ViewDisplay.class); ViewProvider provider = control.createMock(ViewProvider.class); View view1 = control.createMock(View.class); @@ -222,25 +222,25 @@ public class NavigatorTest extends TestCase { // prepare mocks: what to expect EasyMock.expect(provider.getViewName("test2")).andReturn("test2"); EasyMock.expect(provider.getView("test2")).andReturn(view2); - EasyMock.expect(manager.getFragment()).andReturn("view1"); + EasyMock.expect(manager.getState()).andReturn("view1"); view2.navigateTo(""); display.showView(view2); - manager.setFragment("test2"); + manager.setState("test2"); EasyMock.expect(provider.getViewName("")).andReturn("test1"); EasyMock.expect(provider.getView("test1")).andReturn(view1); - EasyMock.expect(manager.getFragment()).andReturn(""); + EasyMock.expect(manager.getState()).andReturn(""); view1.navigateTo(""); display.showView(view1); - manager.setFragment("test1"); + manager.setState("test1"); EasyMock.expect(provider.getViewName("test1/params")) .andReturn("test1"); EasyMock.expect(provider.getView("test1")).andReturn(view1); - EasyMock.expect(manager.getFragment()).andReturn("view2"); + EasyMock.expect(manager.getState()).andReturn("view2"); view1.navigateTo("params"); display.showView(view1); - manager.setFragment("test1/params"); + manager.setState("test1/params"); control.replay(); @@ -255,7 +255,7 @@ public class NavigatorTest extends TestCase { public void testListeners() { IMocksControl control = EasyMock.createControl(); - FragmentManager manager = control.createMock(FragmentManager.class); + NavigationStateManager manager = control.createMock(NavigationStateManager.class); ViewDisplay display = control.createMock(ViewDisplay.class); ViewProvider provider = control.createMock(ViewProvider.class); View view1 = control.createMock(View.class); @@ -271,10 +271,10 @@ public class NavigatorTest extends TestCase { ViewChangeEvent event1 = new ViewChangeEvent(navigator, null, view1, "test1", ""); listener.addExpectedIsViewChangeAllowed(event1, true); - EasyMock.expect(manager.getFragment()).andReturn(""); + EasyMock.expect(manager.getState()).andReturn(""); view1.navigateTo(""); display.showView(view1); - manager.setFragment("test1"); + manager.setState("test1"); listener.addExpectedNavigatorViewChange(event1); EasyMock.expect(provider.getViewName("test2")).andReturn("test2"); @@ -282,10 +282,10 @@ public class NavigatorTest extends TestCase { ViewChangeEvent event2 = new ViewChangeEvent(navigator, view1, view2, "test2", ""); listener.addExpectedIsViewChangeAllowed(event2, true); - EasyMock.expect(manager.getFragment()).andReturn("view1"); + EasyMock.expect(manager.getState()).andReturn("view1"); view2.navigateTo(""); display.showView(view2); - manager.setFragment("test2"); + manager.setState("test2"); listener.addExpectedNavigatorViewChange(event2); control.replay(); @@ -304,7 +304,7 @@ public class NavigatorTest extends TestCase { public void testBlockNavigation() { IMocksControl control = EasyMock.createControl(); - FragmentManager manager = control.createMock(FragmentManager.class); + NavigationStateManager manager = control.createMock(NavigationStateManager.class); ViewDisplay display = control.createMock(ViewDisplay.class); ViewProvider provider = control.createMock(ViewProvider.class); View view1 = control.createMock(View.class); @@ -318,7 +318,7 @@ public class NavigatorTest extends TestCase { // first listener blocks first view change EasyMock.expect(provider.getViewName("test1")).andReturn("test1"); EasyMock.expect(provider.getView("test1")).andReturn(view1); - EasyMock.expect(manager.getFragment()).andReturn(""); + EasyMock.expect(manager.getState()).andReturn(""); ViewChangeEvent event1 = new ViewChangeEvent(navigator, null, view1, "test1", ""); listener1.addExpectedIsViewChangeAllowed(event1, false); @@ -326,7 +326,7 @@ public class NavigatorTest extends TestCase { // second listener blocks second view change EasyMock.expect(provider.getViewName("test1/test")).andReturn("test1"); EasyMock.expect(provider.getView("test1")).andReturn(view1); - EasyMock.expect(manager.getFragment()).andReturn(""); + EasyMock.expect(manager.getState()).andReturn(""); ViewChangeEvent event2 = new ViewChangeEvent(navigator, null, view1, "test1", "test"); listener1.addExpectedIsViewChangeAllowed(event2, true); @@ -335,28 +335,28 @@ public class NavigatorTest extends TestCase { // both listeners allow view change EasyMock.expect(provider.getViewName("test1/bar")).andReturn("test1"); EasyMock.expect(provider.getView("test1")).andReturn(view1); - EasyMock.expect(manager.getFragment()).andReturn(""); + EasyMock.expect(manager.getState()).andReturn(""); ViewChangeEvent event3 = new ViewChangeEvent(navigator, null, view1, "test1", "bar"); listener1.addExpectedIsViewChangeAllowed(event3, true); listener2.addExpectedIsViewChangeAllowed(event3, true); view1.navigateTo("bar"); display.showView(view1); - manager.setFragment("test1/bar"); + manager.setState("test1/bar"); listener1.addExpectedNavigatorViewChange(event3); listener2.addExpectedNavigatorViewChange(event3); // both listeners allow view change from non-null view EasyMock.expect(provider.getViewName("test2")).andReturn("test2"); EasyMock.expect(provider.getView("test2")).andReturn(view2); - EasyMock.expect(manager.getFragment()).andReturn("view1"); + EasyMock.expect(manager.getState()).andReturn("view1"); ViewChangeEvent event4 = new ViewChangeEvent(navigator, view1, view2, "test2", ""); listener1.addExpectedIsViewChangeAllowed(event4, true); listener2.addExpectedIsViewChangeAllowed(event4, true); view2.navigateTo(""); display.showView(view2); - manager.setFragment("test2"); + manager.setState("test2"); listener1.addExpectedNavigatorViewChange(event4); listener2.addExpectedNavigatorViewChange(event4); diff --git a/server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java b/server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java index 18ed52cc2a..d58ff28b00 100644 --- a/server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java +++ b/server/tests/src/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java @@ -39,9 +39,9 @@ public class UriFragmentManagerTest extends TestCase { EasyMock.replay(page); // test manager using the mock - assertEquals("Incorrect fragment value", "", manager.getFragment()); - manager.setFragment("test"); - assertEquals("Incorrect fragment value", "test", manager.getFragment()); + assertEquals("Incorrect fragment value", "", manager.getState()); + manager.setState("test"); + assertEquals("Incorrect fragment value", "test", manager.getState()); } public void testListener() { |