@@ -0,0 +1,2801 @@
+package com.google.sps.servlets;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.After;%0A%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.JUnit4;%0Aimport static com.google.sps.tool.Tool.compareJson;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.mockito.Mockito.*;%0A%0Aimport java.io.PrintWriter;%0Aimport java.io.StringWriter;%0Aimport java.io.IOException;%0A%0Aimport javax.servlet.annotation.WebServlet;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport com.google.appengine.tools.development.testing.LocalServiceTestHelper;%0Aimport com.google.appengine.tools.development.testing.LocalUserServiceTestConfig;%0Aimport com.google.appengine.api.users.UserService;%0Aimport com.google.appengine.api.users.UserServiceFactory;%0Aimport com.google.sps.data.User;%0Aimport com.google.gson.Gson;%0A%0A%0A@RunWith(JUnit4.class)%0Apublic final class LoginServletTest %7B%0A  %0A  private final LocalServiceTestHelper helper =%0A        new LocalServiceTestHelper(new LocalUserServiceTestConfig())%0A          .setEnvIsAdmin(true).setEnvIsLoggedIn(true)%0A          .setEnvEmail(%22test@gmail.com%22).setEnvAuthDomain(%22gmail.com%22);%0A%0A%0A  // Need to update this servlet test%0A  private static final User USER_A = new User(%22null%22, %22/_ah/logout?continue%5Cu003d%252F%22, %22test@gmail.com%22, true);%0A  private static final User USER_B = new User(%22/_ah/login?continue%5Cu003d%252F%22, %22null%22, %22null%22, false);%0A  private HttpServletRequest mockRequest;%0A  private HttpServletResponse mockResponse;%0A  private StringWriter responseWriter;%0A  private LoginServlet servlet;%0A%0A%0A  @Before%0A  public void setUp() throws Exception %7B%0A      helper.setUp();%0A      servlet = new LoginServlet();%0A      mockRequest = mock(HttpServletRequest.class);%0A      mockResponse = mock(HttpServletResponse.class);%0A      %0A      // Set up a fake HTTP response %0A      responseWriter = new StringWriter();%0A      when(mockResponse.getWriter()).thenReturn(new PrintWriter(responseWriter));%0A  %7D%0A%0A  @After%0A  public void tearDown() throws Exception %7B%0A      helper.setEnvIsLoggedIn(true);%0A      helper.tearDown();%0A  %7D%0A%0A  @Test%0A  public void userLoggedIn() throws Exception %7B%0A      servlet.doGet(mockRequest, mockResponse);%0A      String response = responseWriter.toString();%0A      String expectedResponse = new Gson().toJson(USER_A);%0A      assertTrue(compareJson(response, expectedResponse));%0A  %7D%0A  %0A  @Test%0A  public void userNotLoggedIn() throws Exception %7B%0A      helper.setEnvIsLoggedIn(false);%0A      servlet.doGet(mockRequest, mockResponse);%0A      String response = responseWriter.toString();%0A      String expectedResponse = new Gson().toJson(USER_B);%0A      assertTrue(compareJson(response, expectedResponse));%0A  %7D%0A%7D

Add test directory to src