public static TestInstanceInfo findTestInstance(List<TestInstanceInfo> testInstances,
                                                   String testName,
                                                   String testInstanceName,
                                                   Long testSetId)
   {
      TestInstanceInfo testInstanceInfo = null;
      String testInstanceName1 = (testInstanceName == null ? testName
               : testInstanceName);
      if (testInstances != null) {
         for (TestInstanceInfo testInstance : testInstances) {
            if (testName.equals(testInstance.getTestName())
                     && testInstanceName1.equals(testInstance.getName())
                     && (testSetId == null || testSetId == testInstance.getTestSetId())) {
               testInstanceInfo = testInstance;
               break;
            }
         }
      }
      return testInstanceInfo;
   }