setValue("#{auctionAction.auction.title}", "BidTestZZZ");
setValue("#{auctionAction.auction.startingPrice}", 1);
setValue("#{auctionAction.auction.description}", "bar");
setValue("#{auctionAction.categoryId}", 1001);
Auction auction = (Auction) getValue("#{auctionAction.auction}");
assert auction.getStatus() == Auction.STATUS_UNLISTED;
invokeAction("#{auctionAction.confirm}");
assert auction.getStatus() == Auction.STATUS_LIVE;
assert auction.getHighBid() == null;
}
}.run();
new FacesRequest()
{
@Override
protected void updateModelValues() throws Exception
{
setValue("#{auctionSearch.searchTerm}", "BidTestZZZ");
}
@Override
protected void invokeApplication() throws Exception
{
assert invokeAction("#{auctionSearch.queryAuctions}") == null;
}
@Override
protected void renderResponse() throws Exception
{
DataModel auctions = (DataModel) Contexts.getSessionContext().get("auctions");
assert auctions.getRowCount() == 1;
Auction auction = ((Auction) auctions.getRowData());
assert auction.getTitle().equals("BidTestZZZ");
assert auction.getHighBid() == null;
}
}.run();
new FacesRequest()
{
@Override
protected void invokeApplication() throws Exception
{
Contexts.getEventContext().set("auction", getValue("#{auctionSearch.auctions[0]}"));
assert invokeAction("#{bidAction.placeBid}") == null;
assert getValue("#{bidAction.outcome}").equals("required");
Contexts.getEventContext().set("bidAmount", "5.00");
assert invokeAction("#{bidAction.placeBid}") == null;
assert getValue("#{bidAction.outcome}").equals("confirm");
assert invokeAction("#{bidAction.confirmBid}").equals("success");
}
}.run();
new FacesRequest()
{
@Override
protected void invokeApplication() throws Exception
{
assert invokeAction("#{auctionSearch.queryAuctions}") == null;
}
protected void renderResponse() throws Exception
{
DataModel auctions = (DataModel) Contexts.getSessionContext().get("auctions");
Auction auction = ((Auction) auctions.getRowData());
assert auction.getHighBid() != null;
}
}.run();
}