@RequestMapping(value = "findEmployees.htm", params = "searchType=findByProject")
  public ModelAndView onSubmitSearchByProject(@RequestParam("projectID") long projectID) {

    log.info("Finding by project ID: " + projectID);
    List<Project> projectList = searchService.listAllProjects();
    List<Employee> employeeList = searchService.findEmployeesByProject(projectID);

    ModelAndView mav = new ModelAndView();
    mav.addObject("projectList", projectList);
    mav.addObject("employeeList", employeeList);
    mav.setViewName("find/employeeSearchForm");
    return mav;
  }
  @RequestMapping(value = "findEmployees.htm", params = "searchType=findByName")
  public ModelAndView onSubmitSearchByName(
      @RequestParam("firstName") String firstName,
      @RequestParam("lastName") String lastName,
      @RequestParam("projectID") long projectID) {

    log.info("Searching by first name: " + firstName + " last name: " + lastName);

    List<Employee> employeeList = searchService.findEmployeesByName(firstName, lastName);
    List<Project> projectList = searchService.listAllProjects();

    ModelAndView mav = new ModelAndView();
    mav.addObject("projectList", projectList);
    mav.addObject("employeeList", employeeList);
    mav.setViewName("find/employeeSearchForm");
    return mav;
  }
 @RequestMapping(value = "findEmployees.htm", params = "!searchType")
 public ModelAndView onInitialSearchFormState() {
   List<Project> projectList = searchService.listAllProjects();
   log.info("Entering search form in its initial state");
   ModelAndView mav = new ModelAndView();
   mav.addObject("projectList", projectList);
   mav.setViewName("find/employeeSearchForm");
   return mav;
 }
  public void testFindEmployeesByProject() {
    List<Employee> result;

    result = service.findEmployeesByProject(100);
    assertNotNull(result);
    assertEquals(result.size(), 0);

    result = service.findEmployeesByProject(1);
    assertNotNull(result);
    assertEquals(result.size(), 0);

    result = service.findEmployeesByProject(4);
    assertNotNull(result);
    assertEquals(result.size(), 1);

    result = service.findEmployeesByProject(2);
    assertNotNull(result);
    assertEquals(result.size(), 2);
  }
  public void testFindEmployeesByName() {
    List<Employee> result;

    result = service.findEmployeesByName("asdasd", "iririr");
    assertNotNull(result);
    assertEquals(result.size(), 0);

    result = service.findEmployeesByName("Ruzwana", "iririr");
    assertNotNull(result);
    assertEquals(result.size(), 0);

    result = service.findEmployeesByName("asdasd", "Bashir");
    assertNotNull(result);
    assertEquals(result.size(), 0);

    result = service.findEmployeesByName("Ruzwana", "Bashir");
    assertNotNull(result);
    assertEquals(result.size(), 1);
    assertTrue(result.get(0).getFirstName().equals("Ruzwana"));
    assertTrue(result.get(0).getLastName().equals("Bashir"));
  }
 public void testListAllProjects() {
   List<Project> result = service.listAllProjects();
   assertNotNull(result);
   assertEquals(result.size(), 8);
 }