@Test
  public void testAcceptRepresentation() throws Exception {
    ChatListResource chatListResource =
        (ChatListResource) ServiceLocator.getAppContext().getBean("chatlistresource_1");
    chatListResource.setFormFactory(
        new FormFactory() {
          public Form getForm(Representation repr) {
            Form form = new Form();
            form.add(new Parameter("chatName", "new_chat_1"));
            form.add(new Parameter("partyName", "party_1"));
            return form;
          }
        });
    chatListResource.acceptRepresentation(Representation.createEmpty());
    Chat chat = ServiceLocator.getChatDao().findChatById(4);
    assertNotNull(chat);
    assertEquals("new_chat_1", chat.getChatName());

    String result = chatListResource.getResponse().getEntity().getText();
    int index = result.indexOf("<html");
    result = result.substring(index);
    assertEquals(
        testHelper.getExpectedString("/org/bds/touch/rest/chatlistresource_resp_expected_1.txt"),
        result);
  }
 @Test
 public void testRepresent() throws Exception {
   ChatListResource userResource =
       (ChatListResource) ServiceLocator.getAppContext().getBean("chatlistresource_1");
   DomRepresentation repr =
       (DomRepresentation) userResource.represent(new Variant(MediaType.TEXT_XML));
   String result = testHelper.indentXml(repr.getDocument());
   assertEquals(
       testHelper.getExpectedString("/org/bds/touch/rest/chatlistresource_expected_1.txt"),
       result);
 }