//////////////////			Methods used ONLY IN TESTS				////////////////////
774643
@VisibleForTesting
	public int numProcessingTimeTimers() {
		int count = 0;
		for (InternalTimerServiceImpl<?, ?> timerService : timerServices.values()) {
			count += timerService.numProcessingTimeTimers();
		}
		return count;
	}
464862
private String generateMethodKey(CtMethod method) throws NotFoundException {
        String classQualifiedName = method.getDeclaringClass().getName();
        String methodSimpleName = method.getName();
        List<String> argClassQualifiedNames = getArgClassQualifiedNames(method);
        return TestMethod.generateMethodKey(classQualifiedName, methodSimpleName, argClassQualifiedNames);
    }
1182840
function validateMethods() {
  xml2js.METHODS = _.pick(xml2js.METHODS, function(methodSpec, methodName) {
    return hasValidTypes(methodSpec, methodName);
  });
  _.each(xml2js.CLASSES, function(classSpec, className) {
    var valid = _.pick(classSpec.methods, function(methodSpec, methodName) {
      return hasValidTypes(methodSpec, className + '.' + methodName, className);
    });
    if (xml2js.opts.strict) {
      xml2js.CLASSES[className].methods = valid;
    }
  });
}
1279082
private void generateTCBasedData(List<TestCaseResult> allTestsList) {
        logger.entering(allTestsList);
        SummarizedData tempClass;
        SummarizedData tempGroupClass;
        Map<String, SummarizedData> mpClassData = new HashMap<String, SummarizedData>();
        int outputSheetRowCounter = 3;

        for (TestCaseResult tcResult : allTestsList) {

            // Segregating for class data
            String sTempClassName = tcResult.getClassName();

            // If class not already added to Class data, then create new ClassObject exists
            if (!mpClassData.containsKey(sTempClassName)) {
                tempClass = new SummarizedData();
                tempClass.setsName(sTempClassName);

            } else {
                tempClass = mpClassData.get(sTempClassName);
            }

            // Adding test to total count
            tempClass.incrementiTotal();

            // Adding all groups to map
            for (String sGroup : tcResult.getGroup()) {

                // Forming a key for the GroupClass map which is <GroupName><ClassName>
                String sGroupClassName = sGroup + sTempClassName;
                if (!mpGroupClassData.containsKey(sGroupClassName)) {
                    tempGroupClass = new SummarizedData();
                    tempGroupClass.setsName(sTempClassName);
                } else {
                    tempGroupClass = mpGroupClassData.get(sGroupClassName);
                }

                tempGroupClass.incrementiTotal();
                tempGroupClass.incrementCount(tcResult.getStatus());
                tempGroupClass.incrementDuration(tcResult.getDurationTaken());
                mpGroupClassData.put(sGroupClassName, tempGroupClass);
            }

            // Segregating for detailed Testcase Status wise data
            List<String> str = new ArrayList<String>();
            str.add(tcResult.getClassName());
            str.add(tcResult.getMethodName());
            str.add(tcResult.getTestDesc());
            str.add(tcResult.getGroup().toString());
            str.add(String.valueOf(tcResult.getDurationTaken()));
            str.add("'" + ReportSheetNames.TESTOUTPUTDETAILSREPORT.getName() + "'!B"
                    + Integer.toString(outputSheetRowCounter));

            List<String> outputStr = new ArrayList<String>();
            outputStr.add("Class Name:" + tcResult.getClassName());
            outputStr.add("Method/Testcase id:" + tcResult.getMethodName());
            outputStr.addAll(tcResult.getssmsg());

            // Based on status, incrementing class count and adding str to correct
            // list for TC detailed report
            switch (tcResult.getStatus()) {
                case ITestResult.FAILURE: {
                    tcFailedData.add(str);
                    // For failed cases adding data for defect description sheet
                    for (int iErrorCount = 0; iErrorCount < tcResult.getError().size(); iErrorCount++) {
                        List<String> tmpList = new ArrayList<String>();
                        tmpList.addAll(0, str);
                        tmpList.add(tcResult.getDefect().get(iErrorCount));
                        tmpList.add(tcResult.getError().get(iErrorCount));
                        outputStr.add("Stacktrace:" + tcResult.getError().get(iErrorCount));
                        tcDefectData.add(tmpList);
                    }
                    break;
                }
                case ITestResult.SUCCESS: {
                    tcPassedData.add(str);
                    break;
                }
                case ITestResult.SKIP: {
                    tcSkippedData.add(str);
                    break;
                }
                default: {
                    break;
                }
            }
            tcOutputData.add(outputStr);
            outputSheetRowCounter = outputSheetRowCounter + 1 + outputStr.size();

            tempClass.incrementCount(tcResult.getStatus());
            // Add to the total runtime of the class
            tempClass.setlRuntime(tempClass.getlRuntime() + tcResult.getDurationTaken());
            mpClassData.put(sTempClassName, tempClass);
        }
        lClasses.addAll(mpClassData.values());
        Collections.sort(lClasses);
        logger.exiting();
    }
1136748
private int afterHookInsertLine(TestMethod method, int codeLineIndex) {
        // if multiple statements exist in one line, afterHook is inserted only after the last statement,
        // since when multi-line statements are like:
        // method(1);method(
        //         2);
        // insertion to the middle of the statement causes problem
        if (!isLineLastStament(method, codeLineIndex)) {
            return -1;
        }
        // insert hook to the next line of the codeLine
        // since insertAt method inserts code just before the specified line
        CodeLine codeLine = method.getCodeBody().get(codeLineIndex);
        return codeLine.getEndLine() + 1;
    }
439018
@SuppressWarnings({"CheckReturnValue", "MockitoUsage", "unchecked"})
    static void verifyInt(MockedVoidMethod method, VerificationMode mode, InOrder
            instanceInOrder) {
        if (onMethodCallDuringVerification.get() != null) {
            throw new IllegalStateException("Verification is already in progress on this "
                    + "thread.");
        }

        ArrayList<Method> verifications = new ArrayList<>();

        /* Set up callback that is triggered when the next static method is called on this thread.
         *
         * This is necessary as we don't know which class the method will be called on. Once the
         * call is intercepted this will
         *    1. Remove all matchers (e.g. eq(), any()) from the matcher stack
         *    2. Call verify on the marker for the class
         *    3. Add the markers back to the stack
         */
        onMethodCallDuringVerification.set((clazz, verifiedMethod) -> {
            // TODO: O holy reflection! Let's hope we can integrate this better.
            try {
                ArgumentMatcherStorageImpl argMatcherStorage = (ArgumentMatcherStorageImpl)
                        mockingProgress().getArgumentMatcherStorage();
                List<LocalizedMatcher> matchers;

                // Matcher are called before verify, hence remove the from the storage
                Method resetStackMethod
                        = argMatcherStorage.getClass().getDeclaredMethod("resetStack");
                resetStackMethod.setAccessible(true);

                matchers = (List<LocalizedMatcher>) resetStackMethod.invoke(argMatcherStorage);

                if (instanceInOrder == null) {
                    verify(staticMockMarker(clazz), mode);
                } else {
                    instanceInOrder.verify(staticMockMarker(clazz), mode);
                }

                // Add the matchers back after verify is called
                Field matcherStackField
                        = argMatcherStorage.getClass().getDeclaredField("matcherStack");
                matcherStackField.setAccessible(true);

                Method pushMethod = matcherStackField.getType().getDeclaredMethod("push",
                        Object.class);

                for (LocalizedMatcher matcher : matchers) {
                    pushMethod.invoke(matcherStackField.get(argMatcherStorage), matcher);
                }
            } catch (NoSuchFieldException | NoSuchMethodException | IllegalAccessException
                    | InvocationTargetException | ClassCastException e) {
                throw new Error("Reflection failed. Do you use a compatible version of "
                        + "mockito?", e);
            }

            verifications.add(verifiedMethod);
        });
        try {
            try {
                // Trigger the method call. This call will be intercepted and trigger the
                // onMethodCallDuringVerification callback.
                method.run();
            } catch (Throwable t) {
                if (t instanceof RuntimeException) {
                    throw (RuntimeException) t;
                } else if (t instanceof Error) {
                    throw (Error) t;
                }
                throw new RuntimeException(t);
            }

            if (verifications.isEmpty()) {
                // Make sure something was intercepted
                throw new IllegalArgumentException("Nothing was verified. Does the lambda call "
                        + "a static method on a 'static' mock/spy ?");
            } else if (verifications.size() > 1) {
                // A lambda might call several methods. In this case it is not clear what should
                // be verified. Hence throw an error.
                throw new IllegalArgumentException("Multiple intercepted calls on methods "
                        + verifications);
            }
        } finally {
            onMethodCallDuringVerification.remove();
        }
    }
281195
@Override
    public TestResult invoke(final TestMethodExecutor testMethodExecutor) {

        assert testMethodExecutor != null : "Test method executor is required";

        // Build the String request according to the wire protocol
        final StringBuilder builder = new StringBuilder();
        builder.append(WireProtocol.COMMAND_TEST_PREFIX);
        builder.append(testMethodExecutor.getInstance().getClass().getName());
        builder.append(SPACE);
        builder.append(testMethodExecutor.getMethod().getName());
        builder.append(WireProtocol.COMMAND_EOF_DELIMITER);
        final String testCommand = builder.toString();
        final PrintWriter writer = this.context.getWriter();

        // Request
        writer.write(testCommand);
        writer.flush();

        try {
            // Read response
            final ObjectInputStream response = new ObjectInputStream(
                    new NoCloseInputStream(context.getSocketInstream()));
            final TestResult testResult = (TestResult) response.readObject();
            response.close();
            return testResult;

        } catch (final IOException ioe) {
            throw new RuntimeException("Could not get test results", ioe);
        } catch (final ClassNotFoundException cnfe) {
            throw new RuntimeException("test result not on the client classpath", cnfe);
        }
    }
371074
static ObjectMethod objectMethodToOverride(ExecutableElement method) {
    String name = method.getSimpleName().toString();
    switch (method.getParameters().size()) {
      case 0:
        if (name.equals("toString")) {
          return ObjectMethod.TO_STRING;
        } else if (name.equals("hashCode")) {
          return ObjectMethod.HASH_CODE;
        }
        break;
      case 1:
        if (name.equals("equals")) {
          TypeMirror param = getOnlyElement(method.getParameters()).asType();
          if (param.getKind().equals(TypeKind.DECLARED)) {
            TypeElement paramType = MoreTypes.asTypeElement(param);
            if (paramType.getQualifiedName().contentEquals("java.lang.Object")) {
              return ObjectMethod.EQUALS;
            }
          }
        }
        break;
      default:
        // No relevant Object methods have more than one parameter.
    }
    return ObjectMethod.NONE;
  }
950742
@Override
	public void visitClassContext(ClassContext classContext) {
		try {
			stack = new OpcodeStack();
			localMethodCalls = new HashMap<>();
			fieldMethodCalls = new HashMap<>();
			staticMethodCalls = new HashMap<>();
			branchTargets = new BitSet();
			super.visitClassContext(classContext);
		} finally {
			stack = null;
			localMethodCalls = null;
			fieldMethodCalls = null;
			staticMethodCalls = null;
			branchTargets = null;
		}
	}
778855
function(mocha, test) {
        test.parent._onlyTests = test.parent._onlyTests.concat(test);
        mocha.options.hasOnly = true;
        return test;
      }
1351258
@Deprecated
    protected Statement withPotentialTimeout(FrameworkMethod method,
            Object test, Statement next) {
        long timeout = getTimeout(method.getAnnotation(Test.class));
        if (timeout <= 0) {
            return next;
        }
        return FailOnTimeout.builder()
               .withTimeout(timeout, TimeUnit.MILLISECONDS)
               .build(next);
    }
225532
private static StackLine getStackLine(
            TestMethodTable table, String classQualifiedName, String methodSimpleName, int line) {
        if (line <= 0) {
            return null; // 0 or negative line number never matches
        }
        List<TestMethod> nameMethods = table.getByName(classQualifiedName, methodSimpleName);
        for (TestMethod method : nameMethods) {
            for (int i = 0; i < method.getCodeBody().size(); i++) {
                CodeLine codeLine = method.getCodeBody().get(i);
                if (codeLine.getStartLine() <= line && line <= codeLine.getEndLine()) {
                    StackLine result = new StackLine();
                    result.setMethodKey(method.getKey());
                    result.setMethod(method);
                    result.setCodeBodyIndex(i);
                    result.setLine(line);
                    return result;
                }
            }
        }
        return null;
    }
1320500
@Override
  public Description matchClass(ClassTree tree, VisitorState state) {
    // TODO(b/36395371): filter here to exclude some classes (e.g. not immutable)
    if (TEST_CLASS.matches(tree, state)) {
      return NO_MATCH;
    }

    for (Tree member : tree.getMembers()) {
      if (isSuppressed(member)) {
        continue;
      }
      if ((member instanceof MethodTree
              && Matchers.methodIsConstructor().matches((MethodTree) member, state))
          || (member instanceof BlockTree && !((BlockTree) member).isStatic())
          || (member instanceof VariableTree && !Matchers.isStatic().matches(member, state))) {
        traverse(member, state);
      }
    }
    return NO_MATCH;
  }
1097648
private void genGetAllMethod(SourceWriter sw, JMethod[] methods,
      TreeLogger treeLogger) {
    sw.println("public DeferredSelector[] getAllSelectors() {return ds;}");
    sw.println("private final DeferredSelector[] ds = new DeferredSelector[] {");
    sw.indent();
    for (JMethod m : methods) {
      Selector selectorAnnotation = m.getAnnotation(Selector.class);
      if (selectorAnnotation == null) {
        continue;
      }
      String selector = selectorAnnotation.value();

      sw.println("new DeferredSelector() {");
      sw.indent();
      sw
          .println("public String getSelector() { return \"" + selector
              + "\"; }");
      sw
          .println("public NodeList<Element> runSelector(Node ctx) { return " +
              (m.getName() + (m.getParameters().length == 0 ? "()" : "(ctx)")) +
              ("NodeList".equals(m.getReturnType().getSimpleSourceName()) ? "" : ".get()") + ";}"
          );
      sw.outdent();
      sw.println("},");
    }
    sw.outdent();
    sw.println("};");
  }
693218
function() {
      var n = JSLitmus._tests.length, markers = [], data = [];
      var d, min = 0, max = -1e10;
      var normalize = jsl.$('test_normalize').checked;

      // Gather test data
      for (var i=0; i < JSLitmus._tests.length; i++) {
        var test = JSLitmus._tests[i];
        if (test.count) {
          var hz = test.getHz(normalize);
          var v = hz != Infinity ? hz : 0;
          data.push(v);
          markers.push('t' + jsl.escape(test.name + '(' + jsl.toLabel(hz)+ ')') + ',000000,0,' +
            markers.length + ',10');
          max = Math.max(v, max);
        }
      }
      if (markers.length <= 0) return null;

      // Build chart title
      var title = document.getElementsByTagName('title');
      title = (title && title.length) ? title[0].innerHTML : null;
      var chart_title = [];
      if (title) chart_title.push(title);
      chart_title.push('Ops/sec (' + platform + ')');

      // Build labels
      var labels = [jsl.toLabel(min), jsl.toLabel(max)];

      var w = 250, bw = 15;
      var bs = 5;
      var h = markers.length*(bw + bs) + 30 + chart_title.length*20;

      var params = {
        chtt: escape(chart_title.join('|')),
        chts: '000000,10',
        cht: 'bhg',                     // chart type
        chd: 't:' + data.join(','),     // data set
        chds: min + ',' + max,          // max/min of data
        chxt: 'x',                      // label axes
        chxl: '0:|' + labels.join('|'), // labels
        chsp: '0,1',
        chm: markers.join('|'),         // test names
        chbh: [bw, 0, bs].join(','),    // bar widths
        // chf: 'bg,lg,0,eeeeee,0,eeeeee,.5,ffffff,1', // gradient
        chs: w + 'x' + h
      };
      return 'http://chart.apis.google.com/chart?' + jsl.join(params, '=', '&');
    }
1087195
@Override public Object invokeMethod(final String name, final Object arguments) {
    if (GantState.dryRun) {
      if (GantState.verbosity > GantState.SILENT) {
        final StringBuilder sb = new StringBuilder();
        int padding = 9 - name.length();
        if (padding < 0) { padding = 0; }
        sb.append("         ".substring(0, padding) + '[' + name + "] ");
        final Object[] args = (Object[]) arguments;
        if (args[0] instanceof Map<?,?>) {
          //////////////////////////////////////////////////////////////////////////////////////////////////////////
          // Eclipse and IntelliJ IDEA warn that (Map) is not a proper cast but using the
          // cast (Map<?,?>) causes a type check error due to the capture algorithm.
          //
          //  TODO : Fix this rather than use a SuppressWarnings.
          //////////////////////////////////////////////////////////////////////////////////////////////////////////
          @SuppressWarnings({ "unchecked", "rawtypes" } ) final Iterator<Map.Entry<?,?>> i =((Map) args[0]).entrySet().iterator();
          while (i.hasNext()) {
            final Map.Entry<?,?> e = i.next();
            sb.append(e.getKey() + " : '" + e.getValue() + '\'');
            if (i.hasNext()) { sb.append(", "); }
          }
          sb.append('\n');
          getProject().log(sb.toString());
          if (args.length == 2) {((Closure<?>) args[1]).call(); }
        }
        else if (args[0] instanceof Closure) { ((Closure<?>) args[0]).call(); }
        else { throw new RuntimeException("Unexpected type of parameter to method " + name); }
      }
      return null;
    }
    return super.invokeMethod(name, arguments);
  }
596748
private void generateDoneMethod(SourceWriter sw, JClassType nonLazyType,
      TreeLogger treeLogger) {
    sw.indent();
    sw.println("public Function done() {");
    sw.indent();
    sw.println("return new Function() {");
    sw.indent();

    sw.println("public void f() {");
    sw.indent();
    String classID = nonLazyType.getSimpleSourceName();
    if ("GQuery".equals(classID)) {
      classID = "GQUERY";
    }

    sw.println(
        "ctx = GQuery.$((Element) getElement()).as(" + nonLazyType.getQualifiedSourceName() + "."
            + classID + ");");
    sw.println("for (int i = 0; i < closures.length(); i++) {");
    sw.indent();
    sw.println("closures.get(i).invoke();");
    sw.outdent();
    sw.println("}");
    sw.outdent();
    sw.println("}");
    sw.outdent();
    sw.println("};");
    sw.outdent();
    sw.println("}");
  }