use of com.google.appengine.samples.angularjs_guestbook.domain.Greeting in project appengine-angular-guestbook-java by googlearchive.
the class GuestbookResourceTest method testSignGuestbook.
@Test
public void testSignGuestbook() throws ServletException, IOException {
HttpServletRequest request = getMockedJsonRequest("{content:\"Test message\"}");
final StringBuffer resultBuffer = new StringBuffer();
HttpServletResponse response = getMockedServletResponse(resultBuffer);
servletContainer.service(URI.create("http://localhost/"), URI.create("/guestbook/default"), request, response);
logger.fine(resultBuffer.toString().trim());
Gson gson = new GsonBuilder().create();
GuestbookResponse result = gson.fromJson(resultBuffer.toString().trim(), GuestbookResponse.class);
assertThat(result.getGuestbookName(), is("default"));
assertThat(result.getGreetings().size(), is(1));
Greeting greeting = result.getGreetings().get(0);
assertThat(greeting.getContent(), is("Test message"));
assertThat(greeting.getAuthor(), is("test@example.com"));
assertThat(greeting.getDate(), instanceOf(Date.class));
assertThat(result.getUserServiceInfo(), nullValue());
}
Aggregations