Program: 114834
Project: 114834
Buggy source:
@Test(groups="String_Node_Str",description="String_Node_Str") public void testAPIAccessWithInvalidToken() throws XPathExpressionException, APIManagerIntegrationTestException {
  apiPublisher.login(user.getUserName(),user.getPassword());
  String apiContext="String_Node_Str";
  String endpointUrl="String_Node_Str";
  APIRequest apiRequest=null;
  try {
    apiRequest=new APIRequest(API_NAME,apiContext,new URL(endpointUrl));
  }
 catch (  MalformedURLException e) {
    log.error("String_Node_Str" + endpointUrl,e);
    assertTrue(false);
  }
  apiRequest.setVersion(API_VERSION);
  apiRequest.setTiersCollection("String_Node_Str");
  apiRequest.setTier("String_Node_Str");
  apiRequest.setProvider(provider);
  apiPublisher.addAPI(apiRequest);
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(API_NAME,user.getUserName(),APILifeCycleState.PUBLISHED);
  apiPublisher.changeAPILifeCycleStatus(updateRequest);
  waitForAPIDeploymentSync(apiRequest.getProvider(),apiRequest.getName(),apiRequest.getVersion(),APIMIntegrationConstants.IS_API_EXISTS);
  String apiInvocationUrl=getAPIInvocationURLHttp(apiContext,API_VERSION);
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str","String_Node_Str" + "String_Node_Str");
  try {
    HttpResponse httpResponse=HttpRequestUtil.doGet(apiInvocationUrl,headers);
    Assert.assertNotNull(httpResponse);
    Assert.assertEquals(401,httpResponse.getResponseCode());
    String responsePayload=httpResponse.getData();
    Assert.assertNotNull(responsePayload);
    String[] responseArray=responsePayload.split("String_Node_Str");
    Assert.assertTrue("String_Node_Str",responseArray.length > 1);
    Assert.assertTrue("String_Node_Str" + "String_Node_Str" + responseArray[1] + "String_Node_Str",URLDecoder.decode(responseArray[1],"String_Node_Str").contains("String_Node_Str"));
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + apiInvocationUrl,e);
    Assert.assertTrue("String_Node_Str" + apiInvocationUrl + "String_Node_Str"+ e.getMessage(),false);
  }
}

Fixed version (ground truth):
@Test(groups="String_Node_Str",description="String_Node_Str") public void testAPIAccessWithInvalidToken() throws XPathExpressionException, APIManagerIntegrationTestException {
  apiPublisher.login(user.getUserName(),user.getPassword());
  String apiContext="String_Node_Str";
  String endpointUrl="String_Node_Str";
  APIRequest apiRequest=null;
  try {
    apiRequest=new APIRequest(API_NAME,apiContext,new URL(endpointUrl));
  }
 catch (  MalformedURLException e) {
    log.error("String_Node_Str" + endpointUrl,e);
    assertTrue(false);
  }
  apiRequest.setVersion(API_VERSION);
  apiRequest.setTiersCollection("String_Node_Str");
  apiRequest.setTier("String_Node_Str");
  apiRequest.setProvider(provider);
  apiPublisher.addAPI(apiRequest);
  APILifeCycleStateRequest updateRequest=new APILifeCycleStateRequest(API_NAME,user.getUserName(),APILifeCycleState.PUBLISHED);
  apiPublisher.changeAPILifeCycleStatus(updateRequest);
  waitForAPIDeploymentSync(apiRequest.getProvider(),apiRequest.getName(),apiRequest.getVersion(),APIMIntegrationConstants.IS_API_EXISTS);
  String apiInvocationUrl=getAPIInvocationURLHttp(apiContext,API_VERSION);
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str","String_Node_Str" + "String_Node_Str");
  try {
    HttpResponse httpResponse=HttpRequestUtil.doGet(apiInvocationUrl,headers);
    Assert.assertNotNull(httpResponse);
    Assert.assertEquals(401,httpResponse.getResponseCode());
    String responsePayload=httpResponse.getData();
    Assert.assertNotNull(responsePayload);
    String description=AXIOMUtil.stringToOM(responsePayload).getFirstChildWithName(new QName("String_Node_Str","String_Node_Str")).getText();
    Assert.assertNotNull("String_Node_Str",description);
    Assert.assertTrue("String_Node_Str" + "String_Node_Str" + description + "String_Node_Str",description.contains("String_Node_Str"));
  }
 catch (  IOException e) {
    log.error("String_Node_Str" + apiInvocationUrl,e);
    Assert.assertTrue("String_Node_Str" + apiInvocationUrl + "String_Node_Str"+ e.getMessage(),false);
  }
catch (  XMLStreamException e) {
    log.error("String_Node_Str",e);
    Assert.assertTrue("String_Node_Str" + e.getMessage(),false);
  }
}