aboutsummaryrefslogtreecommitdiffstats
path: root/server/tests/src
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-08-31 13:57:37 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2012-08-31 14:03:04 +0300
commit61a1218d388b85b496e0fd98f2a5c5226ab4f83d (patch)
treef36fc84b66d6a285a59f50c141f821ec197362e9 /server/tests/src
parent7f343ebc78bec7391d64dfc942409b3dbaa5d914 (diff)
downloadvaadin-framework-61a1218d388b85b496e0fd98f2a5c5226ab4f83d.tar.gz
vaadin-framework-61a1218d388b85b496e0fd98f2a5c5226ab4f83d.zip
Change View.navigateTo(String) to View.enter(ViewChangeEvent) (#9055, #9056)
Diffstat (limited to 'server/tests/src')
-rw-r--r--server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java5
-rw-r--r--server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java38
2 files changed, 31 insertions, 12 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java b/server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java
index 5db0df4280..2b9d0e533d 100644
--- a/server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java
+++ b/server/tests/src/com/vaadin/tests/server/navigator/ClassBasedViewProviderTest.java
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import com.vaadin.navigator.Navigator.ClassBasedViewProvider;
import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.Label;
public class ClassBasedViewProviderTest extends TestCase {
@@ -28,8 +29,8 @@ public class ClassBasedViewProviderTest extends TestCase {
public String parameters = null;
@Override
- public void navigateTo(String parameters) {
- this.parameters = parameters;
+ public void enter(ViewChangeEvent event) {
+ parameters = event.getParameters();
}
}
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 ca060a4651..fa48e4bff6 100644
--- a/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java
+++ b/server/tests/src/com/vaadin/tests/server/navigator/NavigatorTest.java
@@ -21,6 +21,7 @@ import java.util.LinkedList;
import junit.framework.TestCase;
import org.easymock.EasyMock;
+import org.easymock.IArgumentMatcher;
import org.easymock.IMocksControl;
import com.vaadin.navigator.NavigationStateManager;
@@ -168,6 +169,23 @@ public class NavigatorTest extends TestCase {
}
}
+ public static ViewChangeEvent eventParametersEqual(final String expected) {
+ EasyMock.reportMatcher(new IArgumentMatcher() {
+ @Override
+ public void appendTo(StringBuffer buffer) {
+ buffer.append("paramsIs(\"" + expected + "\")");
+ }
+
+ @Override
+ public boolean matches(Object actual) {
+ return actual instanceof ViewChangeEvent
+ && expected.equals(((ViewChangeEvent) actual)
+ .getParameters());
+ }
+ });
+ return null;
+ }
+
public void testBasicNavigation() {
IMocksControl control = EasyMock.createControl();
NavigationStateManager manager = control
@@ -181,14 +199,14 @@ public class NavigatorTest extends TestCase {
EasyMock.expect(provider.getViewName("test1")).andReturn("test1");
EasyMock.expect(provider.getView("test1")).andReturn(view1);
EasyMock.expect(manager.getState()).andReturn("");
- view1.navigateTo("");
+ view1.enter(eventParametersEqual(""));
display.showView(view1);
manager.setState("test1");
EasyMock.expect(provider.getViewName("test2/")).andReturn("test2");
EasyMock.expect(provider.getView("test2")).andReturn(view2);
EasyMock.expect(manager.getState()).andReturn("view1");
- view2.navigateTo("");
+ view2.enter(eventParametersEqual(""));
display.showView(view2);
manager.setState("test2");
@@ -196,7 +214,7 @@ public class NavigatorTest extends TestCase {
.andReturn("test1");
EasyMock.expect(provider.getView("test1")).andReturn(view1);
EasyMock.expect(manager.getState()).andReturn("view2");
- view1.navigateTo("params");
+ view1.enter(eventParametersEqual("params"));
display.showView(view1);
manager.setState("test1/params");
@@ -224,14 +242,14 @@ public class NavigatorTest extends TestCase {
EasyMock.expect(provider.getViewName("test2")).andReturn("test2");
EasyMock.expect(provider.getView("test2")).andReturn(view2);
EasyMock.expect(manager.getState()).andReturn("view1");
- view2.navigateTo("");
+ view2.enter(eventParametersEqual(""));
display.showView(view2);
manager.setState("test2");
EasyMock.expect(provider.getViewName("")).andReturn("test1");
EasyMock.expect(provider.getView("test1")).andReturn(view1);
EasyMock.expect(manager.getState()).andReturn("");
- view1.navigateTo("");
+ view1.enter(eventParametersEqual(""));
display.showView(view1);
manager.setState("test1");
@@ -239,7 +257,7 @@ public class NavigatorTest extends TestCase {
.andReturn("test1");
EasyMock.expect(provider.getView("test1")).andReturn(view1);
EasyMock.expect(manager.getState()).andReturn("view2");
- view1.navigateTo("params");
+ view1.enter(eventParametersEqual("params"));
display.showView(view1);
manager.setState("test1/params");
@@ -274,7 +292,7 @@ public class NavigatorTest extends TestCase {
"test1", "");
listener.addExpectedIsViewChangeAllowed(event1, true);
EasyMock.expect(manager.getState()).andReturn("");
- view1.navigateTo("");
+ view1.enter(eventParametersEqual(""));
display.showView(view1);
manager.setState("test1");
listener.addExpectedNavigatorViewChange(event1);
@@ -285,7 +303,7 @@ public class NavigatorTest extends TestCase {
"test2", "");
listener.addExpectedIsViewChangeAllowed(event2, true);
EasyMock.expect(manager.getState()).andReturn("view1");
- view2.navigateTo("");
+ view2.enter(eventParametersEqual(""));
display.showView(view2);
manager.setState("test2");
listener.addExpectedNavigatorViewChange(event2);
@@ -343,7 +361,7 @@ public class NavigatorTest extends TestCase {
"test1", "bar");
listener1.addExpectedIsViewChangeAllowed(event3, true);
listener2.addExpectedIsViewChangeAllowed(event3, true);
- view1.navigateTo("bar");
+ view1.enter(EasyMock.isA(ViewChangeEvent.class));
display.showView(view1);
manager.setState("test1/bar");
listener1.addExpectedNavigatorViewChange(event3);
@@ -357,7 +375,7 @@ public class NavigatorTest extends TestCase {
"test2", "");
listener1.addExpectedIsViewChangeAllowed(event4, true);
listener2.addExpectedIsViewChangeAllowed(event4, true);
- view2.navigateTo("");
+ view2.enter(EasyMock.isA(ViewChangeEvent.class));
display.showView(view2);
manager.setState("test2");
listener1.addExpectedNavigatorViewChange(event4);