@@ -0,0 +1,2616 @@
+package test.unit.haushaltsbuch;%0A%0Aimport static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Matchers.eq;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0Aimport java.io.IOException;%0Aimport java.util.Arrays;%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport javax.servlet.ServletConfig;%0Aimport javax.servlet.ServletContext;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport haushaltsbuch.DeleteException;%0Aimport haushaltsbuch.Entry;%0Aimport haushaltsbuch.EntryRepository;%0Aimport haushaltsbuch.InsertException;%0Aimport haushaltsbuch.web.controllers.BaseController;%0Aimport haushaltsbuch.web.controllers.ListController;%0Aimport test.helpers.TestEntry;%0A%0Apublic class ListControllerTest extends ListController%0A%7B%0A  private EntryRepository _repository;%0A%0A  @Before%0A  public void setUp() throws Exception%0A  %7B%0A    _repository = mock(EntryRepository.class);%0A%0A    ServletConfig servletConfig = mock(ServletConfig.class);%0A    ServletContext servletContext = mock(ServletContext.class);%0A%0A    when(servletConfig.getServletContext()).thenReturn(servletContext);%0A    when(servletContext.getAttribute(BaseController.CTX_ATTR_NAME)).thenReturn(_repository);%0A%0A    init(servletConfig);%0A  %7D%0A%0A  @Test%0A  public void testEmpty() throws ServletException, IOException, DeleteException, InsertException%0A  %7B%0A    HttpServletRequest request = mock(HttpServletRequest.class);%0A    HttpServletResponse response = mock(HttpServletResponse.class);%0A%0A    List%3CEntry%3E all = Collections.emptyList();%0A    when(_repository.getAll()).thenReturn(all);%0A%0A    doGet(request, response);%0A%0A    verify(request).setAttribute(eq(%22entries%22), eq(all));%0A    verify(request).setAttribute(eq(%22title%22), anyString());%0A    verify(request).setAttribute(eq(%22view%22), eq(%22all.jsp%22));%0A  %7D%0A%0A  @Test%0A  public void testSome() throws ServletException, IOException, DeleteException, InsertException%0A  %7B%0A    HttpServletRequest request = mock(HttpServletRequest.class);%0A    HttpServletResponse response = mock(HttpServletResponse.class);%0A%0A    List%3CEntry%3E all = asList(new TestEntry(), new TestEntry());%0A    when(_repository.getAll()).thenReturn(all);%0A%0A    doGet(request, response);%0A%0A    verify(request).setAttribute(eq(%22entries%22), eq(all));%0A    verify(request).setAttribute(eq(%22title%22), anyString());%0A    verify(request).setAttribute(eq(%22view%22), eq(%22all.jsp%22));%0A  %7D%0A%0A  private List%3CEntry%3E asList(Entry... entries)%0A  %7B%0A    return Arrays.asList(entries);%0A  %7D%0A%7D%0A

Add test for list controller