package test.unit.haushaltsbuch;

import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import haushaltsbuch.DeleteException;
import haushaltsbuch.InsertException;
import haushaltsbuch.web.controllers.RootController;

public class RootControllerTest extends RootController
{
  @Before
  public void setUp() throws Exception
  {
    init(mock(ServletConfig.class));
  }

  @Test
  public void testEmpty() throws ServletException, IOException, DeleteException, InsertException
  {
    HttpServletRequest request = mock(HttpServletRequest.class);
    HttpServletResponse response = mock(HttpServletResponse.class);

    doGet(request, response);

    verify(request).setAttribute(eq("title"), anyString());
    verify(request).setAttribute(eq("view"), eq("index.jsp"));
  }
}

Add test for home (root) page
Add test for home (root) page
