Program: 189313
Project: 189313
Buggy source:
/** 
 * Test adding and editing an Email Template.
 */
@Test public void testAddingEditingDeletingEmbargoTypes(){
  LOGIN();
  final String EDIT_URL=Router.reverse("String_Node_Str").url;
  final String REMOVE_URL=Router.reverse("String_Node_Str").url;
  Map<String,String> params=new HashMap<String,String>();
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  Response response=POST(EDIT_URL,params);
  assertContentMatch("String_Node_Str",response);
  Pattern ID_PATTERN=Pattern.compile("String_Node_Str");
  Matcher tokenMatcher=ID_PATTERN.matcher(getContent(response));
  assertTrue(tokenMatcher.find());
  String idString=tokenMatcher.group(1);
  assertNotNull(idString);
  Long id=Long.valueOf(idString);
  JPA.em().getTransaction().commit();
  JPA.em().clear();
  JPA.em().getTransaction().begin();
  assertNotNull(settingRepo.findEmbargoType(id));
  assertEquals("String_Node_Str",settingRepo.findEmbargoType(id).getName());
  assertEquals("String_Node_Str",settingRepo.findEmbargoType(id).getDescription());
  assertEquals(new Integer(4),settingRepo.findEmbargoType(id).getDuration());
  assertEquals(true,settingRepo.findEmbargoType(id).isActive());
  params.clear();
  params.put("String_Node_Str",String.valueOf(id));
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  response=POST(EDIT_URL,params);
  assertContentMatch("String_Node_Str",response);
  JPA.em().getTransaction().commit();
  JPA.em().clear();
  JPA.em().getTransaction().begin();
  assertEquals("String_Node_Str",settingRepo.findEmbargoType(id).getName());
  assertEquals("String_Node_Str",settingRepo.findEmbargoType(id).getDescription());
  assertEquals(null,settingRepo.findEmbargoType(id).getDuration());
  assertEquals(false,settingRepo.findEmbargoType(id).isActive());
  params.clear();
  params.put("String_Node_Str","String_Node_Str" + id);
  response=POST(REMOVE_URL,params);
  assertContentMatch("String_Node_Str",response);
  JPA.em().getTransaction().commit();
  JPA.em().clear();
  JPA.em().getTransaction().begin();
  assertNull(settingRepo.findEmbargoType(id));
}

Fixed version (ground truth):
/** 
 * Test adding and editing an Email Template.
 */
@Test public void testAddingEditingDeletingEmbargoTypes(){
  LOGIN();
  final String EDIT_URL=Router.reverse("String_Node_Str").url;
  final String REMOVE_URL=Router.reverse("String_Node_Str").url;
  Map<String,String> params=new HashMap<String,String>();
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  Response response=POST(EDIT_URL,params);
  assertContentMatch("String_Node_Str",response);
  Pattern ID_PATTERN=Pattern.compile("String_Node_Str");
  Matcher tokenMatcher=ID_PATTERN.matcher(getContent(response));
  assertTrue(tokenMatcher.find());
  String idString=tokenMatcher.group(1);
  assertNotNull(idString);
  Long id=Long.valueOf(idString);
  JPA.em().getTransaction().commit();
  JPA.em().clear();
  JPA.em().getTransaction().begin();
  assertNotNull(settingRepo.findEmbargoType(id));
  assertEquals("String_Node_Str",settingRepo.findEmbargoType(id).getName());
  assertEquals("String_Node_Str",settingRepo.findEmbargoType(id).getDescription());
  assertEquals(new Integer(4),settingRepo.findEmbargoType(id).getDuration());
  assertEquals(true,settingRepo.findEmbargoType(id).isActive());
  params.clear();
  params.put("String_Node_Str",String.valueOf(id));
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  params.put("String_Node_Str","String_Node_Str");
  response=POST(EDIT_URL,params);
  assertContentMatch("String_Node_Str",response);
  JPA.em().getTransaction().commit();
  JPA.em().clear();
  JPA.em().getTransaction().begin();
  assertEquals("String_Node_Str",settingRepo.findEmbargoType(id).getName());
  assertEquals("String_Node_Str",settingRepo.findEmbargoType(id).getDescription());
  assertEquals(null,settingRepo.findEmbargoType(id).getDuration());
  assertEquals(false,settingRepo.findEmbargoType(id).isActive());
  params.clear();
  params.put("String_Node_Str",String.valueOf(id));
  response=POST(REMOVE_URL,params);
  assertContentMatch("String_Node_Str",response);
  JPA.em().getTransaction().commit();
  JPA.em().clear();
  JPA.em().getTransaction().begin();
  assertNull(settingRepo.findEmbargoType(id));
}