Package org.agoncal.book.javaee7.chapter15

Examples of org.agoncal.book.javaee7.chapter15.Book


    assertEquals("http://localhost:8282/13/customer/1334", response.getLocation().toString());
  }

  @Test
  public void shouldCreateACustomerWithURIBuilderFromMethod() {
    Response response = client.target("http://localhost:8282/13/customer/fromMethod").request().post(Entity.entity(new Customer13("John", "Smith", "jsmith@gmail.com", "1334565"), MediaType.APPLICATION_XML));
    assertEquals(201, response.getStatus());
    assertEquals("fromMethod", response.getLocation().toString());
  }
View Full Code Here


    assertEquals("fromMethod", response.getLocation().toString());
  }

  @Test
  public void shouldCreateACustomerWithURIBuilderFromResource() {
    Response response = client.target("http://localhost:8282/13/customer/fromResource").request().post(Entity.entity(new Customer13("John", "Smith", "jsmith@gmail.com", "1334565"), MediaType.APPLICATION_XML));
    assertEquals(201, response.getStatus());
    assertEquals("/13/customer/1334", response.getLocation().toString());
  }
View Full Code Here

    assertEquals("/13/customer/1334", response.getLocation().toString());
  }

  @Test
  public void shouldUpdateCustomer() {
    Response response = client.target("http://localhost:8282/13/customer/cust1334").request().put(Entity.entity(new Customer13("John", "Smith", "jsmith@gmail.com", "1334565"), MediaType.APPLICATION_XML));
    assertEquals(200, response.getStatus());
  }
View Full Code Here

    m.marshal(customer, writer);
  }

  @Test
  public void shouldMarshallAListOfCustomers() throws JAXBException {
    Customers13 customers = new Customers13();
    customers.add(new Customer13("John", "Smith", "jsmith@gmail.com", "1334565"));
    customers.add(new Customer13("John", "Smith", "jsmith@gmail.com", "1334565"));
    StringWriter writer = new StringWriter();
    JAXBContext context = JAXBContext.newInstance(Customers13.class);
    Marshaller m = context.createMarshaller();
    m.marshal(customers, writer);
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void viewBook() throws Exception
  {
    Book mockBook = new Book("xxId", "xxName");
    Page page = new ViewBook(mockBook);
    tester.startPage(page);

    // assertion
    tester.assertRenderedPage(ViewBook.class);
View Full Code Here

  @Test
  public void bookmarkableLink() throws Exception
  {
    // for WebPage without default constructor, I define a TestPageSource to
    // let the page be instatiated lately.
    Book mockBook = new Book("xxId", "xxName");
    tester.startPage(new ViewBook(mockBook));

    // assertion
    tester.assertRenderedPage(ViewBook.class);
    tester.clickLink("link");
View Full Code Here

   * @throws Exception
   */
  @Test
  public void pageConstructor() throws Exception
  {
    Book mockBook = new Book("xxId", "xxName");
    Page page = new ViewBook(mockBook);
    tester.startPage(page);

    // assertion
    tester.assertRenderedPage(ViewBook.class);
View Full Code Here

   * @throws Exception
   */
  @Test
  public void viewBook() throws Exception
  {
    Book mockBook = new Book("xxId", "xxName");
    Page page = new ViewBook(mockBook);
    tester.startPage(page);

    // assertion
    tester.assertRenderedPage(ViewBook.class);
View Full Code Here

  @Test
  public void bookmarkableLink() throws Exception
  {
    // for WebPage without default constructor, I define a TestPageSource to
    // let the page be instatiated lately.
    Book mockBook = new Book("xxId", "xxName");
    tester.startPage(new ViewBook(mockBook));

    // assertion
    tester.assertRenderedPage(ViewBook.class);
    tester.clickLink("link");
View Full Code Here

   * @throws Exception
   */
  @Test
  public void pageConstructor() throws Exception
  {
    Book mockBook = new Book("xxId", "xxName");
    Page page = new ViewBook(mockBook);
    tester.startPage(page);

    // assertion
    tester.assertRenderedPage(ViewBook.class);
View Full Code Here

TOP

Related Classes of org.agoncal.book.javaee7.chapter15.Book

Copyright © 2018 www.massapicom. 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.