Package com.xebia.lottery.ui

Source Code of com.xebia.lottery.ui.LotteriesPageTest

package com.xebia.lottery.ui;

import static org.easymock.EasyMock.*;

import org.apache.wicket.util.tester.FormTester;
import org.junit.Test;

import com.xebia.cqrs.bus.Response;
import com.xebia.lottery.commands.CreateLotteryCommand;

/**
* Simple test using the WicketTester
*/
public class LotteriesPageTest extends LotteryPageTestCase {

    @Test
    public void testRenderMyPage() {
        expect(bus.sendAndWaitForResponse(isA(CreateLotteryCommand.class))).andReturn(new Response());
        replayMocks();
       
        // start and render the test page
        tester.startPage(LotteriesPage.class);

        // assert rendered page class
        tester.assertRenderedPage(LotteriesPage.class);

        FormTester form = tester.newFormTester("createLotteryForm");
        form.setValue("name", "lottery");
        form.setValue("drawingTimestamp:date", "12/12/09"); // US format :(
        form.setValue("drawingTimestamp:hours", "11");
        form.setValue("drawingTimestamp:minutes", "44");
        form.setValue("prizeAmount", "1000.00");
        form.setValue("ticketPrice", "1.50");
        form.submit();
       
        tester.assertNoErrorMessage();
        verifyMocks();
    }

}
TOP

Related Classes of com.xebia.lottery.ui.LotteriesPageTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.