@@ -0,0 +1,2680 @@
+package com.google.step.coffee.servlets;%0A%0Aimport com.google.appengine.api.datastore.*;%0Aimport com.google.step.coffee.HttpError;%0Aimport com.google.step.coffee.JsonServletRequest;%0Aimport com.google.step.coffee.TestHelper;%0Aimport com.google.step.coffee.entity.Group;%0Aimport org.junit.Test;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0A%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0Aimport static org.hamcrest.MatcherAssert.assertThat;%0Aimport static org.hamcrest.CoreMatchers.*;%0A%0Apublic class GroupInfoServletTest extends TestHelper %7B%0A  private Group getGroupByKey(Key key) throws Exception %7B%0A    HttpServletRequest request = mock(HttpServletRequest.class);%0A    when(request.getParameter(%22id%22)).thenReturn(KeyFactory.keyToString(key));%0A    JsonServletRequest jsonServletRequest = new JsonServletRequest(request);%0A    return (Group) new GroupInfoServlet().get(jsonServletRequest);%0A  %7D%0A%0A  @Test(expected = HttpError.class)%0A  public void testGetInvalidId() throws Exception %7B%0A    getGroupByKey(KeyFactory.createKey(%22group%22, 12345));%0A  %7D%0A%0A  @Test%0A  public void testGetValidId() throws Exception %7B%0A    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();%0A%0A    Entity groupEntity = new Entity(%22group%22);%0A    groupEntity.setProperty(%22name%22, %22foo%22);%0A    groupEntity.setProperty(%22description%22, %22bar%22);%0A    datastore.put(groupEntity);%0A%0A    assertThat(getGroupByKey(groupEntity.getKey()), equalTo(%0A        Group.builder()%0A            .setId(KeyFactory.keyToString(groupEntity.getKey()))%0A            .setName(%22foo%22)%0A            .setDescription(%22bar%22)%0A            .build()%0A    ));%0A  %7D%0A%0A  @Test%0A  public void testUpdate() throws Exception %7B%0A    DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();%0A%0A    Entity groupEntity = new Entity(%22group%22);%0A    groupEntity.setProperty(%22name%22, %22foo%22);%0A    groupEntity.setProperty(%22description%22, %22bar%22);%0A    datastore.put(groupEntity);%0A%0A    HttpServletRequest request = mock(HttpServletRequest.class);%0A    when(request.getParameter(%22id%22)).thenReturn(KeyFactory.keyToString(groupEntity.getKey()));%0A    when(request.getParameter(%22name%22)).thenReturn(%22updated foo%22);%0A    when(request.getParameter(%22description%22)).thenReturn(%22updated bar%22);%0A    JsonServletRequest jsonServletRequest = new JsonServletRequest(request);%0A    new GroupInfoServlet().post(jsonServletRequest);%0A%0A    groupEntity = datastore.get(groupEntity.getKey());%0A%0A    assertThat(Group.fromEntity(groupEntity), equalTo(%0A        Group.builder()%0A            .setId(KeyFactory.keyToString(groupEntity.getKey()))%0A            .setName(%22updated foo%22)%0A            .setDescription(%22updated bar%22)%0A            .build()%0A    ));%0A  %7D%0A%7D%0A

Add tests for GroupInfoServlet