本文整理匯總了Java中org.apache.wicket.util.tester.WicketTester.processRequest方法的典型用法代碼示例。如果您正苦於以下問題:Java WicketTester.processRequest方法的具體用法?Java WicketTester.processRequest怎麽用?Java WicketTester.processRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.wicket.util.tester.WicketTester
的用法示例。
在下文中一共展示了WicketTester.processRequest方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testGetVariable
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testGetVariable() {
final WicketTester tester = getTester();
TestAjaxBehavior behavior = new TestAjaxBehavior("testA");
Map map = new Map("map");
map.add(behavior);
tester.startComponentInPage(map);
MockHttpServletRequest request = this.prepareRequest(tester, behavior, "testA", "testValue");
tester.processRequest(request);
StringValue actual = behavior.actualVariableValue;
assertThat(actual.isEmpty()).isFalse();
assertThat(actual.toString()).isEqualTo("testValue");
}
示例2: testGetMissingVariable
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testGetMissingVariable() {
final WicketTester tester = getTester();
TestAjaxBehavior behavior = new TestAjaxBehavior("testB");
Map map = new Map("map");
map.add(behavior);
tester.startComponentInPage(map);
MockHttpServletRequest request = prepareRequest(tester, behavior, "testA", "testA");
tester.processRequest(request);
StringValue missingValue = behavior.actualVariableValue;
assertThat(missingValue.isEmpty()).isTrue();
}
示例3: testRespondToLocationEvent
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testRespondToLocationEvent() {
WicketTester tester = this.getTester();
final Map map = new Map("map");
final TestLocationEventBehavior behavior = new TestLocationEventBehavior();
map.add(behavior);
tester.startComponentInPage(map);
MockHttpServletRequest request = this.prepareRequest(tester, behavior, MapEventType.LOCATION_FOUND, this.locationEvent);
tester.processRequest(request);
assertThat(behavior.actualLocationEvent)
.isNotNull()
.isEqualToComparingFieldByField(this.locationEvent);
assertThat(behavior.actualError).isNull();
}
示例4: testRespondToLocationError
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testRespondToLocationError() {
WicketTester tester = this.getTester();
final Map map = new Map("map");
final TestLocationEventBehavior behavior = new TestLocationEventBehavior();
map.add(behavior);
tester.startComponentInPage(map);
MockHttpServletRequest request = this.prepareRequest(tester, behavior, MapEventType.LOCATION_ERROR, this.errorEvent);
tester.processRequest(request);
assertThat(behavior.actualError)
.isNotNull()
.isEqualToComparingFieldByField(this.errorEvent);
assertThat(behavior.actualLocationEvent).isNull();
}
示例5: testDontRespondToEmptyErrorEvent
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testDontRespondToEmptyErrorEvent() {
WicketTester tester = this.getTester();
final Map map = new Map("map");
final TestLocationEventBehavior behavior = new TestLocationEventBehavior();
map.add(behavior);
tester.startComponentInPage(map);
MockHttpServletRequest request = this.prepareRequest(tester, behavior, MapEventType.LOCATION_ERROR.getJavascriptName(), "");
tester.processRequest(request);
assertThat(behavior.actualError).isNull();
assertThat(behavior.actualLocationEvent).isNull();
}
示例6: testDontTriggerEventOnMissingJson
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testDontTriggerEventOnMissingJson() {
final WicketTester tester = this.getTester();
final TestAjaxEventBehavior behavior = new TestAjaxEventBehavior(MapEventType.CLICK);
final Map map = new Map("map");
map.add(behavior);
tester.startComponentInPage(map);
final MockHttpServletRequest request = this.prepareRequest(tester, behavior,
MapEventType.CLICK.getJavascriptName(), "");
tester.processRequest(request);
assertThat(behavior.wasTriggered).isFalse();
}
示例7: testOnResponseTriggersEvent
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testOnResponseTriggersEvent() {
final WicketTester tester = this.getTester();
final TestAjaxEventBehavior behavior = new TestAjaxEventBehavior(MapEventType.CLICK);
final Map map = new Map("map");
map.add(behavior);
tester.startComponentInPage(map);
final PlainEvent jsonEvent = PlainEvent.of(MapEventType.CLICK);
final MockHttpServletRequest request = this.prepareRequest(tester, behavior, MapEventType.CLICK, jsonEvent);
tester.processRequest(request);
assertThat(behavior.wasTriggered).isTrue();
assertThat(behavior.lastEvent).isEqualToComparingFieldByField(jsonEvent);
}
示例8: testTriggersSupportedEvents
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testTriggersSupportedEvents() {
final WicketTester tester = this.getTester();
Map map = new Map("map");
ImmutableMap.Builder<MapEventType, TestMouseEventBehavior> behaviors = ImmutableMap.builder();
for (MapEventType eventType : MouseEventBehavior.SUPPORTED_EVENTS) {
final MouseEvent expectedEvent = this.prepareMouseEvent(eventType);
final TestMouseEventBehavior behavior = new TestMouseEventBehavior(eventType, expectedEvent);
map.add(behavior);
behaviors.put(eventType, behavior);
}
tester.startComponentInPage(map);
for (java.util.Map.Entry<MapEventType, TestMouseEventBehavior> entry : behaviors.build().entrySet()) {
MouseEvent expected = this.prepareMouseEvent(entry.getKey());
MockHttpServletRequest request = this.prepareRequest(tester, entry.getValue(), entry.getKey(), expected);
tester.processRequest(request);
assertThat(entry.getValue().actualEvent)
.as("Event [%s] was not triggered.", entry.getKey())
.isEqualToComparingFieldByField(expected);
}
}