Program: 114778
Project: 114778
Buggy source:
@Test(description="String_Node_Str") public void getAllEndpointUrlsTest() throws Exception {
  HttpResponse getApiResponse=apiStore.getAllPublishedAPIs();
  assertEquals(getApiResponse.getResponseCode(),Response.Status.OK.getStatusCode());
  JSONObject getApiJsonObject=new JSONObject(getApiResponse.getData());
  assertFalse(getApiJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
  JSONArray getApiJsonArray=getApiJsonObject.getJSONArray("String_Node_Str");
  boolean isApiAvailable=false;
  boolean isEndpointUrlValid=false;
  boolean isHttpsUrlAvailable=false;
  boolean isHttpUrlAvailable=false;
  String environmentName="String_Node_Str";
  String environmentType="String_Node_Str";
  for (int apiIndex=0; apiIndex < getApiJsonArray.length(); apiIndex++) {
    if (getApiJsonArray.getJSONObject(apiIndex).getString("String_Node_Str").equals(apiName)) {
      isApiAvailable=true;
      HttpResponse getEndpointApiResponse=apiStore.getApiEndpointUrls(apiName,apiVersion,apiProvider);
      assertEquals(getEndpointApiResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
      JSONObject getEndpointJsonObject=new JSONObject(getEndpointApiResponse.getData());
      assertFalse(getEndpointJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
      JSONArray getEndPointUrlsJsonArray=getEndpointJsonObject.getJSONArray("String_Node_Str");
      for (int index=0; index < getEndPointUrlsJsonArray.length(); index++) {
        if (getEndPointUrlsJsonArray.getJSONObject(index).getString("String_Node_Str").contains(apiContext)) {
          isEndpointUrlValid=true;
          assertTrue(getEndPointUrlsJsonArray.getJSONObject(index).getString("String_Node_Str").equalsIgnoreCase(environmentName),"String_Node_Str");
          assertTrue(getEndPointUrlsJsonArray.getJSONObject(index).getString("String_Node_Str").equalsIgnoreCase(environmentType),"String_Node_Str");
          JSONArray environmentUrlsArray=getEndPointUrlsJsonArray.getJSONObject(index).getJSONArray("String_Node_Str");
          Map<String,String> urlMap=new HashMap<String,String>();
          for (int mapIndex=0; mapIndex < environmentUrlsArray.length(); mapIndex++) {
            String jsonArrayElement=environmentUrlsArray.getString(mapIndex);
            String[] keyValue=jsonArrayElement.split("String_Node_Str");
            urlMap.put(keyValue[0],keyValue[1]);
            URL url=new URL(keyValue[1]);
            if (keyValue[0].equals("String_Node_Str")) {
              isHttpsUrlAvailable=true;
              assertEquals(url.getProtocol(),keyValue[0],"String_Node_Str");
              assertEquals(url.getPath(),"String_Node_Str" + apiContext + "String_Node_Str"+ apiVersion,"String_Node_Str");
            }
 else             if (keyValue[0].equals("String_Node_Str")) {
              isHttpUrlAvailable=true;
              assertEquals(url.getProtocol(),keyValue[0],"String_Node_Str");
              assertEquals(url.getPath(),"String_Node_Str" + apiContext + "String_Node_Str"+ apiVersion,"String_Node_Str");
            }
            if (isHttpsUrlAvailable == true && isHttpUrlAvailable == true) {
              break;
            }
          }
        }
      }
      break;
    }
  }
  assertTrue(isHttpsUrlAvailable,"String_Node_Str");
  assertTrue(isHttpUrlAvailable,"String_Node_Str");
  assertTrue(isEndpointUrlValid,"String_Node_Str");
  assertTrue(isApiAvailable,"String_Node_Str");
}

Fixed version (ground truth):
@Test(description="String_Node_Str") public void getAllEndpointUrlsTest() throws Exception {
  HttpResponse getApiResponse=apiStore.getAllPublishedAPIs();
  assertEquals(getApiResponse.getResponseCode(),Response.Status.OK.getStatusCode());
  JSONObject getApiJsonObject=new JSONObject(getApiResponse.getData());
  assertFalse(getApiJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
  JSONArray getApiJsonArray=getApiJsonObject.getJSONArray("String_Node_Str");
  boolean isApiAvailable=false;
  boolean isEndpointUrlValid=false;
  boolean isHttpsUrlAvailable=false;
  boolean isHttpUrlAvailable=false;
  String environmentName="String_Node_Str";
  String environmentType="String_Node_Str";
  for (int apiIndex=0; apiIndex < getApiJsonArray.length(); apiIndex++) {
    if (getApiJsonArray.getJSONObject(apiIndex).getString("String_Node_Str").equals(apiName)) {
      isApiAvailable=true;
      HttpResponse getEndpointApiResponse=apiStore.getApiEndpointUrls(apiName,apiVersion,apiProvider);
      assertEquals(getEndpointApiResponse.getResponseCode(),Response.Status.OK.getStatusCode(),"String_Node_Str");
      JSONObject getEndpointJsonObject=new JSONObject(getEndpointApiResponse.getData());
      assertFalse(getEndpointJsonObject.getBoolean("String_Node_Str"),"String_Node_Str");
      JSONArray getEndPointUrlsJsonArray=getEndpointJsonObject.getJSONArray("String_Node_Str");
      for (int index=0; index < getEndPointUrlsJsonArray.length(); index++) {
        if (getEndPointUrlsJsonArray.getJSONObject(index).getString("String_Node_Str").contains(apiContext)) {
          isEndpointUrlValid=true;
          assertTrue(getEndPointUrlsJsonArray.getJSONObject(index).getString("String_Node_Str").equalsIgnoreCase(environmentName),"String_Node_Str");
          assertTrue(getEndPointUrlsJsonArray.getJSONObject(index).getString("String_Node_Str").equalsIgnoreCase(environmentType),"String_Node_Str");
          JSONArray environmentUrlsArray=getEndPointUrlsJsonArray.getJSONObject(index).getJSONArray("String_Node_Str");
          Map<String,String> urlMap=new HashMap<String,String>();
          for (int mapIndex=0; mapIndex < environmentUrlsArray.length(); mapIndex++) {
            String jsonArrayElement=environmentUrlsArray.getString(mapIndex);
            if (jsonArrayElement.startsWith("String_Node_Str") || jsonArrayElement.startsWith("String_Node_Str")) {
              String[] keyValue=jsonArrayElement.split("String_Node_Str");
              urlMap.put(keyValue[0],keyValue[1]);
              URL url=new URL(keyValue[1]);
              if (keyValue[0].equals("String_Node_Str")) {
                isHttpsUrlAvailable=true;
                assertEquals(url.getProtocol(),keyValue[0],"String_Node_Str");
                assertEquals(url.getPath(),"String_Node_Str" + apiContext + "String_Node_Str"+ apiVersion,"String_Node_Str");
              }
 else               if (keyValue[0].equals("String_Node_Str")) {
                isHttpUrlAvailable=true;
                assertEquals(url.getProtocol(),keyValue[0],"String_Node_Str");
                assertEquals(url.getPath(),"String_Node_Str" + apiContext + "String_Node_Str"+ apiVersion,"String_Node_Str");
              }
              if (isHttpsUrlAvailable == true && isHttpUrlAvailable == true) {
                break;
              }
            }
          }
        }
      }
      break;
    }
  }
  assertTrue(isHttpsUrlAvailable,"String_Node_Str");
  assertTrue(isHttpUrlAvailable,"String_Node_Str");
  assertTrue(isEndpointUrlValid,"String_Node_Str");
  assertTrue(isApiAvailable,"String_Node_Str");
}