Java Reference
In-Depth Information
Logger log;
@Test
public void testTicketAgency () throws
Exception {
SeatType seatType = new SeatType();
seatType.setDescription("description");
seatType.setPrice(30);
seatType.setQuantity(5);
ticketService.createSeatType(seatType);
log.info("Seat type created
"+seatType.getDescription());
assertNotNull(seatType.getId());
}
Here, the
testTicketAgency
method will create a new
SeatType
attribute using
the
createSeatType
method from the
TicketService
class. Note how we inject
TicketService
just as we would if we were running this code on the server side.
Our first test case is now ready. We will just need to add an Arquillian configuration
file named
arquillian.xml
into our project, under
src/test/resources
:
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.org/schema/
arquillian"
xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/
arquillian
http://jboss.org/schema/arquillian/
arquillian_1_0.xsd">
<defaultProtocol type="Servlet 3.0" />