Program: 189354
Project: 189354
Buggy source:
/** 
 * Test that we can remove and add each type of parameter (except for the submission date) from the current action filter. To do this the test will run through each parameter type add it to the filter, confirm that it has been added. Then once all the parameters have been added it will verify that they are all still present. Finally in the same order it will remove them one-by-one.
 */
@Test public void testAddRemoveEachTypeOfFilterParameter(){
  LOGIN();
  Person reviewer=personRepo.findPersonsByRole(RoleType.REVIEWER).get(0);
  EmbargoType embargo1=settingRepo.findAllEmbargoTypes().get(0);
  EmbargoType embargo2=settingRepo.findAllEmbargoTypes().get(1);
  String[] possibleNavs={"String_Node_Str","String_Node_Str"};
  for (  String nav : possibleNavs) {
    Map<String,Object> routeArgs=new HashMap<String,Object>();
    routeArgs.put("String_Node_Str",nav);
    final String LIST_URL=(nav.equals("String_Node_Str")) ? Router.reverse("String_Node_Str",routeArgs).url : Router.reverse("String_Node_Str",routeArgs).url;
    final String FILTER_URL=Router.reverse("String_Node_Str",routeArgs).url;
    final String CUSTOMIZE_FILTERS_URL=Router.reverse("String_Node_Str",routeArgs).url;
    String facets="String_Node_Str";
    for (    SearchFacet facet : SearchFacet.values()) {
      if (facets.length() > 0)       facets+="String_Node_Str";
      facets+="String_Node_Str" + facet.getId();
    }
    Map<String,String> params=new HashMap<String,String>();
    params.put("String_Node_Str",facets);
    params.put("String_Node_Str","String_Node_Str");
    POST(CUSTOMIZE_FILTERS_URL,params);
    Response response=GET(LIST_URL);
    assertContentMatch("String_Node_Str",response);
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str" + reviewer.getId());
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str" + embargo1.getId());
    GET(FILTER_URL + "String_Node_Str" + embargo2.getId());
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    response=GET(LIST_URL);
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str" + reviewer.getId()));
    assertFalse(getContent(response).contains("String_Node_Str" + reviewer.getId()));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str" + embargo1.getId()));
    assertFalse(getContent(response).contains("String_Node_Str" + embargo1.getId()));
    assertTrue(getContent(response).contains("String_Node_Str" + embargo2.getId()));
    assertFalse(getContent(response).contains("String_Node_Str" + embargo2.getId()));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str" + reviewer.getId());
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str" + embargo1.getId());
    GET(FILTER_URL + "String_Node_Str" + embargo2.getId());
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    response=GET(LIST_URL);
    assertContentMatch("String_Node_Str",response);
  }
}

Fixed version (ground truth):
/** 
 * Test that we can remove and add each type of parameter (except for the submission date) from the current action filter. To do this the test will run through each parameter type add it to the filter, confirm that it has been added. Then once all the parameters have been added it will verify that they are all still present. Finally in the same order it will remove them one-by-one.
 */
@Test public void testAddRemoveEachTypeOfFilterParameter(){
  LOGIN();
  Person reviewer=personRepo.findPersonsByRole(RoleType.REVIEWER).get(0);
  EmbargoType embargo1=settingRepo.findAllEmbargoTypes().get(0);
  EmbargoType embargo2=settingRepo.findAllEmbargoTypes().get(1);
  String[] possibleNavs={"String_Node_Str","String_Node_Str"};
  for (  String nav : possibleNavs) {
    Map<String,Object> routeArgs=new HashMap<String,Object>();
    routeArgs.put("String_Node_Str",nav);
    final String LIST_URL=(nav.equals("String_Node_Str")) ? Router.reverse("String_Node_Str",routeArgs).url : Router.reverse("String_Node_Str",routeArgs).url;
    final String FILTER_URL=Router.reverse("String_Node_Str",routeArgs).url;
    final String CUSTOMIZE_FILTERS_URL=Router.reverse("String_Node_Str",routeArgs).url;
    String facets="String_Node_Str";
    for (    SearchFacet facet : SearchFacet.values()) {
      if (facets.length() > 0)       facets+="String_Node_Str";
      facets+="String_Node_Str" + facet.getId();
    }
    Map<String,String> params=new HashMap<String,String>();
    params.put("String_Node_Str",facets);
    params.put("String_Node_Str","String_Node_Str");
    POST(CUSTOMIZE_FILTERS_URL,params);
    Response response=GET(LIST_URL);
    assertContentMatch("String_Node_Str",response);
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str" + reviewer.getId());
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str" + embargo1.getId());
    GET(FILTER_URL + "String_Node_Str" + embargo2.getId());
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    response=GET(LIST_URL);
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str" + reviewer.getId()));
    assertFalse(getContent(response).contains("String_Node_Str" + reviewer.getId()));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str" + embargo1.getId() + "String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str" + embargo1.getId() + "String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str" + embargo2.getId()));
    assertFalse(getContent(response).contains("String_Node_Str" + embargo2.getId()));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    assertTrue(getContent(response).contains("String_Node_Str"));
    assertFalse(getContent(response).contains("String_Node_Str"));
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str" + reviewer.getId());
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str" + embargo1.getId());
    GET(FILTER_URL + "String_Node_Str" + embargo2.getId());
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    GET(FILTER_URL + "String_Node_Str");
    response=GET(LIST_URL);
    assertContentMatch("String_Node_Str",response);
  }
}