Program: 176795
Project: 176795
Buggy source:
@Test @PerfTest(invocations=1000) public void testCRUD(){
  WebResource webResource=resource();
  restClient=new RESTClientImpl();
  restClient.initialize(webResource,mediaType);
  if (MediaType.APPLICATION_XML.equals(mediaType)) {
    bookStr1="String_Node_Str";
    bookStr2="String_Node_Str";
    pk1="String_Node_Str";
    pk2="String_Node_Str";
  }
 else   if (MediaType.APPLICATION_JSON.equals(mediaType)) {
    bookStr1="String_Node_Str";
    bookStr2="String_Node_Str";
    pk1="String_Node_Str";
    pk2="String_Node_Str";
  }
 else {
    Assert.fail("String_Node_Str" + mediaType);
    return;
  }
  applicationToken=restClient.getApplicationToken("String_Node_Str");
  Assert.assertNotNull(applicationToken);
  Assert.assertTrue(applicationToken.startsWith("String_Node_Str"));
  sessionToken=restClient.getSessionToken(applicationToken);
  Assert.assertNotNull(sessionToken);
  Assert.assertTrue(sessionToken.startsWith("String_Node_Str"));
  String insertResponse1=restClient.insertEntity(sessionToken,bookStr1,"String_Node_Str");
  String insertResponse2=restClient.insertEntity(sessionToken,bookStr2,"String_Node_Str");
  Assert.assertNotNull(insertResponse1);
  Assert.assertNotNull(insertResponse2);
  Assert.assertTrue(insertResponse1.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(insertResponse2.indexOf("String_Node_Str") > 0);
  String foundBook=restClient.findEntity(sessionToken,pk1,"String_Node_Str");
  Assert.assertNotNull(foundBook);
  if (MediaType.APPLICATION_JSON.equals(mediaType)) {
    foundBook="String_Node_Str" + foundBook + "String_Node_Str";
  }
  Assert.assertTrue(foundBook.indexOf("String_Node_Str") > 0);
  foundBook=foundBook.replaceAll("String_Node_Str","String_Node_Str");
  String updatedBook=restClient.updateEntity(sessionToken,foundBook,"String_Node_Str");
  Assert.assertNotNull(updatedBook);
  Assert.assertTrue(updatedBook.indexOf("String_Node_Str") > 0);
  String jpaQuery="String_Node_Str";
  String queryResult=restClient.runJPAQuery(sessionToken,jpaQuery,new HashMap<String,Object>());
  log.debug("String_Node_Str" + queryResult);
  String allBooks=restClient.getAllEntities(sessionToken,"String_Node_Str");
  Assert.assertNotNull(allBooks);
  Assert.assertTrue(allBooks.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(allBooks.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(allBooks.indexOf("String_Node_Str") > 0);
  log.debug(allBooks);
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str","String_Node_Str");
  String booksByAuthor=restClient.runNamedJPAQuery(sessionToken,Book.class.getSimpleName(),"String_Node_Str",params);
  Assert.assertNotNull(booksByAuthor);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertFalse(booksByAuthor.indexOf("String_Node_Str") > 0);
  log.debug(booksByAuthor);
  Map<String,Object> paramsPublication=new HashMap<String,Object>();
  paramsPublication.put("String_Node_Str","String_Node_Str");
  String booksByPublication=restClient.runNamedJPAQuery(sessionToken,Book.class.getSimpleName(),"String_Node_Str",paramsPublication);
  Assert.assertNotNull(booksByPublication);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertFalse(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  log.debug(booksByAuthor);
  String nativeQuery="String_Node_Str";
  String nativeQueryResult=restClient.runNativeQuery(sessionToken,"String_Node_Str",nativeQuery,new HashMap<String,Object>());
  log.debug("String_Node_Str" + nativeQueryResult);
  Assert.assertNotNull(nativeQueryResult);
  Assert.assertTrue(nativeQueryResult.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(nativeQueryResult.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(nativeQueryResult.indexOf("String_Node_Str") > 0);
  String namedNativeQuerySelectResult=restClient.runNamedNativeQuery(sessionToken,"String_Node_Str","String_Node_Str",new HashMap<String,Object>());
  log.debug("String_Node_Str" + namedNativeQuerySelectResult);
  Assert.assertNotNull(namedNativeQuerySelectResult);
  Assert.assertTrue(namedNativeQuerySelectResult.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(namedNativeQuerySelectResult.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(namedNativeQuerySelectResult.indexOf("String_Node_Str") > 0);
  restClient.deleteEntity(sessionToken,updatedBook,pk1,"String_Node_Str");
  restClient.deleteEntity(sessionToken,updatedBook,pk2,"String_Node_Str");
  restClient.closeSession(sessionToken);
  restClient.closeApplication(applicationToken);
}

Fixed version (ground truth):
@Test @PerfTest(invocations=10) public void testCRUD(){
  if (MediaType.APPLICATION_XML.equals(mediaType)) {
    bookStr1="String_Node_Str";
    bookStr2="String_Node_Str";
    pk1="String_Node_Str";
    pk2="String_Node_Str";
  }
 else   if (MediaType.APPLICATION_JSON.equals(mediaType)) {
    bookStr1="String_Node_Str";
    bookStr2="String_Node_Str";
    pk1="String_Node_Str";
    pk2="String_Node_Str";
  }
 else {
    Assert.fail("String_Node_Str" + mediaType);
    return;
  }
  applicationToken=restClient.getApplicationToken("String_Node_Str");
  Assert.assertNotNull(applicationToken);
  Assert.assertTrue(applicationToken.startsWith("String_Node_Str"));
  sessionToken=restClient.getSessionToken(applicationToken);
  Assert.assertNotNull(sessionToken);
  Assert.assertTrue(sessionToken.startsWith("String_Node_Str"));
  String insertResponse1=restClient.insertEntity(sessionToken,bookStr1,"String_Node_Str");
  String insertResponse2=restClient.insertEntity(sessionToken,bookStr2,"String_Node_Str");
  Assert.assertNotNull(insertResponse1);
  Assert.assertNotNull(insertResponse2);
  Assert.assertTrue(insertResponse1.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(insertResponse2.indexOf("String_Node_Str") > 0);
  String foundBook=restClient.findEntity(sessionToken,pk1,"String_Node_Str");
  Assert.assertNotNull(foundBook);
  if (MediaType.APPLICATION_JSON.equals(mediaType)) {
    foundBook="String_Node_Str" + foundBook + "String_Node_Str";
  }
  Assert.assertTrue(foundBook.indexOf("String_Node_Str") > 0);
  foundBook=foundBook.replaceAll("String_Node_Str","String_Node_Str");
  String updatedBook=restClient.updateEntity(sessionToken,foundBook,"String_Node_Str");
  Assert.assertNotNull(updatedBook);
  Assert.assertTrue(updatedBook.indexOf("String_Node_Str") > 0);
  String jpaQuery="String_Node_Str";
  String queryResult=restClient.runJPAQuery(sessionToken,jpaQuery,new HashMap<String,Object>());
  log.debug("String_Node_Str" + queryResult);
  String allBooks=restClient.getAllEntities(sessionToken,"String_Node_Str");
  Assert.assertNotNull(allBooks);
  Assert.assertTrue(allBooks.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(allBooks.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(allBooks.indexOf("String_Node_Str") > 0);
  log.debug(allBooks);
  Map<String,Object> params=new HashMap<String,Object>();
  params.put("String_Node_Str","String_Node_Str");
  String booksByAuthor=restClient.runNamedJPAQuery(sessionToken,Book.class.getSimpleName(),"String_Node_Str",params);
  Assert.assertNotNull(booksByAuthor);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertFalse(booksByAuthor.indexOf("String_Node_Str") > 0);
  log.debug(booksByAuthor);
  Map<String,Object> paramsPublication=new HashMap<String,Object>();
  paramsPublication.put("String_Node_Str","String_Node_Str");
  String booksByPublication=restClient.runNamedJPAQuery(sessionToken,Book.class.getSimpleName(),"String_Node_Str",paramsPublication);
  Assert.assertNotNull(booksByPublication);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertFalse(booksByAuthor.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(booksByAuthor.indexOf("String_Node_Str") > 0);
  log.debug(booksByAuthor);
  String nativeQuery="String_Node_Str";
  String nativeQueryResult=restClient.runNativeQuery(sessionToken,"String_Node_Str",nativeQuery,new HashMap<String,Object>());
  log.debug("String_Node_Str" + nativeQueryResult);
  Assert.assertNotNull(nativeQueryResult);
  Assert.assertTrue(nativeQueryResult.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(nativeQueryResult.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(nativeQueryResult.indexOf("String_Node_Str") > 0);
  String namedNativeQuerySelectResult=restClient.runNamedNativeQuery(sessionToken,"String_Node_Str","String_Node_Str",new HashMap<String,Object>());
  log.debug("String_Node_Str" + namedNativeQuerySelectResult);
  Assert.assertNotNull(namedNativeQuerySelectResult);
  Assert.assertTrue(namedNativeQuerySelectResult.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(namedNativeQuerySelectResult.indexOf("String_Node_Str") > 0);
  Assert.assertTrue(namedNativeQuerySelectResult.indexOf("String_Node_Str") > 0);
  restClient.deleteEntity(sessionToken,updatedBook,pk1,"String_Node_Str");
  restClient.deleteEntity(sessionToken,updatedBook,pk2,"String_Node_Str");
  restClient.closeSession(sessionToken);
  restClient.closeApplication(applicationToken);
  if (AUTO_MANAGE_SCHEMA) {
    truncateColumnFamily();
  }
}