當前位置: 首頁>>代碼示例>>Java>>正文


Java WicketTester類代碼示例

本文整理匯總了Java中org.apache.wicket.util.tester.WicketTester的典型用法代碼示例。如果您正苦於以下問題:Java WicketTester類的具體用法?Java WicketTester怎麽用?Java WicketTester使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WicketTester類屬於org.apache.wicket.util.tester包,在下文中一共展示了WicketTester類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testNumberButton

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Test
public void testNumberButton(){
	WicketTester tester = createTester();
	final Boxed<Integer> pageBox = new Boxed<Integer>();
	
	BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
		private static final long serialVersionUID = -4486050808642574868L;

		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
			pageBox.value=page.getObject();
		}
	};
	paginator.setTotalResults(Model.of(100));
	paginator.setNumberResultsPerPage(10);
	tester.startComponentInPage(paginator);
	tester.clickLink("paginator:page:4:link");
	assertEquals(4, (int) pageBox.value);
	tester.assertEnabled("paginator:last:link");
	tester.assertEnabled("paginator:next:link");
	tester.assertEnabled("paginator:previous:link");
	tester.assertEnabled("paginator:first:link");
	tester.assertLabel("paginator:page:2:link:label", "5");
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:25,代碼來源:BootstrapPaginatorTest.java

示例2: setUp

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Before
public void setUp() {
    applicationContextMock = new ApplicationContextMock();
    WicketApplication wicketApp = new WicketApplication();
    wicketApp.getComponentInstantiationListeners()
    .add(new SpringComponentInjector(wicketApp,applicationContextMock));
    tester = new WicketTester(wicketApp);

    applicationContextMock.putBean(new PersonRepository(){
        @Override
        public List<Person> findAllPersons() {
          return Collections.emptyList();
        }
    });

}
 
開發者ID:sparsick,項目名稱:ansible-docker-talk,代碼行數:17,代碼來源:TestHomePage.java

示例3: setUp

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
public void setUp() throws Exception{
    super.setUp();
    Persistor.useTestEnvironment();
    attributes.add(baseAttribute);
    attributes.add(depAttribute);
    AttributeTypeTree attributeTree = new AttributeTypeTree(attributes);
    eventType = new EapEventType("TestType", attributeTree);
    ArrayList<EapEventType> eventTypes = new ArrayList<>();
    eventTypes.add(eventType);
    EapEventType.save(eventTypes);
    tester = new WicketTester(new UNICORNApplication());
    tester.startPage(GeneratorPage.class);
    tester.startComponentInPage(new DependenciesPanel("dependenciesPanel" , new GeneratorPage()));
    // get form
    List<Form> list = new ArrayList<>();
    Page x = tester.getLastRenderedPage();
    for (Component form : x.visitChildren(Form.class)) {
        list.add((Form) form);
    }
    formPath = list.get(0).getPageRelativePath();
    listViewPath = formPath + ":dependenciesContainer:dependenciesListview";
}
 
開發者ID:bptlab,項目名稱:Unicorn,代碼行數:23,代碼來源:DependenciesPanelTest.java

示例4: testRenderComponent

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Test
public void testRenderComponent(){
	WicketTester tester = createTester();
	BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
		private static final long serialVersionUID = -4486050808642574868L;

		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
		}
	};
	paginator.setTotalResults(Model.of(100));
	tester.startComponentInPage(paginator);
	tester.assertDisabled("paginator:first:link");
	tester.assertDisabled("paginator:previous:link");
	tester.assertEnabled("paginator:next:link");
	tester.assertEnabled("paginator:last:link");
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:18,代碼來源:BootstrapPaginatorTest.java

示例5: testLastButton

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Test
public void testLastButton(){
	WicketTester tester = createTester();
	final Boxed<Integer> pageBox = new Boxed<Integer>();
	
	BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
		private static final long serialVersionUID = -4486050808642574868L;

		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
			pageBox.value=page.getObject();
		}
	};
	paginator.setTotalResults(Model.of(100));
	paginator.setNumberResultsPerPage(10);
	tester.startComponentInPage(paginator);
	
	tester.clickLink("paginator:last:link");
	assertEquals(9, (int) pageBox.value);
	tester.assertDisabled("paginator:last:link");
	tester.assertDisabled("paginator:next:link");
	tester.assertEnabled("paginator:previous:link");
	tester.assertEnabled("paginator:first:link");
	
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:26,代碼來源:BootstrapPaginatorTest.java

示例6: testNextButton

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Test
public void testNextButton(){
	WicketTester tester = createTester();
	final Boxed<Integer> pageBox = new Boxed<Integer>();
	
	BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
		private static final long serialVersionUID = -4486050808642574868L;

		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
			pageBox.value=page.getObject();
		}
	};
	paginator.setTotalResults(Model.of(100));
	tester.startComponentInPage(paginator);
	tester.clickLink("paginator:next:link");
	assertEquals(1, (int) pageBox.value);
	tester.assertEnabled("paginator:last:link");
	tester.assertEnabled("paginator:next:link");
	tester.assertEnabled("paginator:previous:link");
	tester.assertEnabled("paginator:first:link");
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:23,代碼來源:BootstrapPaginatorTest.java

示例7: testPreviousButton

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Test
public void testPreviousButton(){
	WicketTester tester = createTester();
	final Boxed<Integer> pageBox = new Boxed<Integer>();
	
	BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
		private static final long serialVersionUID = -4486050808642574868L;

		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
			pageBox.value=page.getObject();
		}
	};
	paginator.setTotalResults(Model.of(100));
	paginator.setModelObject(2);
	tester.startComponentInPage(paginator);
	tester.clickLink("paginator:previous:link");
	assertEquals(1, (int) pageBox.value);
	tester.assertEnabled("paginator:last:link");
	tester.assertEnabled("paginator:next:link");
	tester.assertEnabled("paginator:previous:link");
	tester.assertEnabled("paginator:first:link");
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:24,代碼來源:BootstrapPaginatorTest.java

示例8: testFirstButton

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Test
public void testFirstButton(){
	WicketTester tester = createTester();
	final Boxed<Integer> pageBox = new Boxed<Integer>();
	
	BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
		private static final long serialVersionUID = -4486050808642574868L;

		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
			pageBox.value=page.getObject();
		}
	};
	paginator.setTotalResults(Model.of(100));
	paginator.setModelObject(2);
	tester.startComponentInPage(paginator);
	tester.clickLink("paginator:first:link");
	assertEquals(0, (int) pageBox.value);
	tester.assertEnabled("paginator:last:link");
	tester.assertEnabled("paginator:next:link");
	tester.assertDisabled("paginator:previous:link");
	tester.assertDisabled("paginator:first:link");
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:24,代碼來源:BootstrapPaginatorTest.java

示例9: testShowHiddenComponents

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Test
public void testShowHiddenComponents(){
	WicketTester tester = createTester();
	BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
		private static final long serialVersionUID = -4486050808642574868L;
		
		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
		}
	};
	
	paginator.setTotalResults(Model.of(100));
	paginator.setShowLastButton(false);
	paginator.setShowFirstButton(false);
	paginator.setShowNextButton(false);
	paginator.setShowPreviousButton(false);
	
	tester.startComponentInPage(paginator);
	tester.assertInvisible("paginator:first:link");
	tester.assertInvisible("paginator:previous:link");
	tester.assertInvisible("paginator:next:link");
	tester.assertInvisible("paginator:last:link");
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:24,代碼來源:BootstrapPaginatorTest.java

示例10: createTester

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
private WicketTester createTester(){
	WicketTester tester = new WicketTester(new WebApplication() {
		
		@Override
		public Class<? extends Page> getHomePage() {
			return null;
		}
	}){
		@Override
		protected String createPageMarkup(String componentId) {
			return "<div class=\"pagination pagination-small pagination-right\" wicket:id=\"paginator\">"+
					"</div>";
		}
	};
	
	return tester;
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:18,代碼來源:BootstrapPaginatorTest.java

示例11: apply

import org.apache.wicket.util.tester.WicketTester; //導入依賴的package包/類
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            WicketTester tester = create();
            List<OClass> testClasses = Lists.newArrayList();
            try {
                testClasses = initTestClasses();
                base.evaluate();
            } finally {
                deleteClassesAndDocuments(testClasses);
                tester.destroy();
            }
        }
    };
}
 
開發者ID:OrienteerBAP,項目名稱:wicket-orientdb,代碼行數:18,代碼來源:WicketOrientDbFilterTesterScope.java

示例12: 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");
}
 
開發者ID:DrunkenPandaFans,項目名稱:wicket-leaflet,代碼行數:18,代碼來源:LeafletAjaxBehaviorTest.java

示例13: 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();
}
 
開發者ID:DrunkenPandaFans,項目名稱:wicket-leaflet,代碼行數:17,代碼來源:LeafletAjaxBehaviorTest.java

示例14: 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();
}
 
開發者ID:DrunkenPandaFans,項目名稱:wicket-leaflet,代碼行數:19,代碼來源:LocationEventBehaviorTest.java

示例15: 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();
}
 
開發者ID:DrunkenPandaFans,項目名稱:wicket-leaflet,代碼行數:19,代碼來源:LocationEventBehaviorTest.java


注:本文中的org.apache.wicket.util.tester.WicketTester類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。