/* (non-Javadoc)
@see org.jmock.internal.InvocationDispatcher#describeMismatch(org.jmock.api.Invocation, org.hamcrest.Description)
490738
public void describeMismatch(Invocation invocation, Description description) {
        describe(description, describedWith(expectations, invocation));
    }
543854
@Override
	public void getModelDescription(StringBuilder out, int indent) {
		indent=0;
		if(!this.unorderedRulesOption.isSet()){
			StringUtils.appendIndented(out, indent, "Method Ordered");
			StringUtils.appendNewline(out);
		}else{
			StringUtils.appendIndented(out, indent, "Method Unordered");
			StringUtils.appendNewline(out);
		}
		if(this.DriftDetectionOption.isSet()){
			StringUtils.appendIndented(out, indent, "Change Detection OFF");
			StringUtils.appendNewline(out);
		}else{
			StringUtils.appendIndented(out, indent, "Change Detection ON");
			StringUtils.appendNewline(out);
		}
		if(this.noAnomalyDetectionOption.isSet()){
			StringUtils.appendIndented(out, indent, "Anomaly Detection OFF");
			StringUtils.appendNewline(out);
		}else{
			StringUtils.appendIndented(out, indent, "Anomaly Detection ON");
			StringUtils.appendNewline(out);
		}
		StringUtils.appendIndented(out, indent, "Number of Rules: " + (this.ruleSet.size()+1));
		StringUtils.appendNewline(out);		
	}
625001
@Override
  public Description matchAnnotation(AnnotationTree tree, VisitorState state) {
    if (!ANNOTATION_MATCHER.matches(tree, state)) {
      return Description.NO_MATCH;
    }

    MethodTree methodTree = ASTHelpers.findEnclosingNode(state.getPath(), MethodTree.class);
    if (methodTree == null) {
      return Description.NO_MATCH;
    }

    MethodSymbol methodSym = ASTHelpers.getSymbol(methodTree);
    if (methodSym == null) {
      return Description.NO_MATCH;
    }

    if (!methodSym.getModifiers().contains(Modifier.ABSTRACT)) {
      return Description.NO_MATCH;
    }

    // Match, find the matched annotation to use for the error message.
    Symbol annotationSym = ASTHelpers.getSymbol(tree);
    if (annotationSym == null) {
      return Description.NO_MATCH;
    }

    return buildDescription(tree)
        .setMessage(
            String.format(
                "@%s cannot be applied to an abstract method", annotationSym.getSimpleName()))
        .build();
  }
287631
public Statement apply(FrameworkMethod method, Description description, Object target,
            Statement statement) {
        if (methodRules.isEmpty() && testRules.isEmpty()) {
            return statement;
        }
        Statement result = statement;
        for (RuleEntry ruleEntry : getSortedEntries()) {
            if (ruleEntry.type == RuleEntry.TYPE_TEST_RULE) {
                result = ((TestRule) ruleEntry.rule).apply(result, description);
            } else {
                result = ((MethodRule) ruleEntry.rule).apply(result, method, target);
            }
        }
        return result;
    }
1200438
@Override
    public java.util.concurrent.Future<DescribeConnectionsResult> describeConnectionsAsync(
            com.amazonaws.handlers.AsyncHandler<DescribeConnectionsRequest, DescribeConnectionsResult> asyncHandler) {

        return describeConnectionsAsync(new DescribeConnectionsRequest(), asyncHandler);
    }
732804
@CheckReturnValue
  public static Description.Builder buildDescriptionFromChecker(
      DiagnosticPosition position, BugChecker checker) {
    return Description.builder(
        position,
        checker.canonicalName(),
        checker.linkUrl(),
        checker.defaultSeverity(),
        checker.message());
  }
1235566
public final void annotationMethodRest() throws RecognitionException {
		int annotationMethodRest_StartIndex = input.index();

		try {
			if ( state.backtracking>0 && alreadyParsedRule(input, 77) ) { return; }

			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:6: ( Identifier '(' ')' ( defaultValue )? )
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:8: Identifier '(' ')' ( defaultValue )?
			{
			match(input,Identifier,FOLLOW_Identifier_in_annotationMethodRest2669); if (state.failed) return;
			match(input,36,FOLLOW_36_in_annotationMethodRest2671); if (state.failed) return;
			match(input,37,FOLLOW_37_in_annotationMethodRest2673); if (state.failed) return;
			// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:27: ( defaultValue )?
			int alt103=2;
			int LA103_0 = input.LA(1);
			if ( (LA103_0==74) ) {
				alt103=1;
			}
			switch (alt103) {
				case 1 :
					// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:28: defaultValue
					{
					pushFollow(FOLLOW_defaultValue_in_annotationMethodRest2676);
					defaultValue();
					state._fsp--;
					if (state.failed) return;
					}
					break;

			}

			}

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
		}
		finally {
			// do for sure before leaving
			if ( state.backtracking>0 ) { memoize(input, 77, annotationMethodRest_StartIndex); }

		}
	}
1055185
@Override
  public Description matchMethodInvocation(MethodInvocationTree t, VisitorState state) {
    if (IS_COLLECTION_MODIFIED_WITH_ITSELF.matches(t, state)) {
      return describe(t, state);
    }
    return Description.NO_MATCH;
  }
447457
public boolean recordReturnDescription(String description) {
    if (currentInfo.documentReturn(description)) {
      populated = true;
      return true;
    } else {
      return false;
    }
  }
26562
@Override
  public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
    return checkInvocation(
        tree, ASTHelpers.getType(tree.getMethodSelect()), state, ASTHelpers.getSymbol(tree));
  }
532112
SimpleJmsListenerEndpoint trace(SimpleJmsListenerEndpoint source) {
		MessageListener delegate = source.getMessageListener();
		if (delegate == null) {
			return source;
		}
		source.setMessageListener(jmsTracing().messageListener(delegate, false));
		return source;
	}
136604
private void detectNestedInvocations(Method daoMethod) {
		if (!Config.IN_PRODUCTION && !daoMethod.getName().startsWith("read")) {
			StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
			for (StackTraceElement stackTraceElement : stackTraceElements) {
				if (daoMethod.getDeclaringClass().getName().equals(stackTraceElement.getClassName()) &&
						!daoMethod.getName().equals(stackTraceElement.getMethodName())) {
					throw new RuntimeException(Utils.
							formatMessage("Method {0}.{1}() was invoked from another method in the same "
							+ "class - {2}.{3}(). DAO implementations should avoid this as it causes objects to be "
							+ "indexed and cached twice per request.",
							daoMethod.getDeclaringClass().getSimpleName(), daoMethod.getName(),
							stackTraceElement.getClassName(), stackTraceElement.getMethodName()));
				}
			}
		}
	}
1321587
private Description describe(MethodInvocationTree methodInvocationTree, VisitorState state) {
    // Find the root of the field access chain, i.e. a.intern().trim() ==> a.
    ExpressionTree identifierExpr = ASTHelpers.getRootAssignable(methodInvocationTree);
    String identifierStr = null;
    Type identifierType = null;
    if (identifierExpr != null) {
      identifierStr = state.getSourceForNode(identifierExpr);
      if (identifierExpr instanceof JCIdent) {
        identifierType = ((JCIdent) identifierExpr).sym.type;
      } else if (identifierExpr instanceof JCFieldAccess) {
        identifierType = ((JCFieldAccess) identifierExpr).sym.type;
      } else {
        throw new IllegalStateException("Expected a JCIdent or a JCFieldAccess");
      }
    }

    Type returnType = getReturnType(((JCMethodInvocation) methodInvocationTree).getMethodSelect());

    Fix fix;
    if (identifierStr != null
        && !"this".equals(identifierStr)
        && returnType != null
        && state.getTypes().isAssignable(returnType, identifierType)) {
      // Fix by assigning the assigning the result of the call to the root receiver reference.
      fix = SuggestedFix.prefixWith(methodInvocationTree, identifierStr + " = ");
    } else {
      // Unclear what the programmer intended.  Delete since we don't know what else to do.
      Tree parent = state.getPath().getParentPath().getLeaf();
      fix = SuggestedFix.delete(parent);
    }
    return describeMatch(methodInvocationTree, fix);
  }
751845
public static <T extends Exception> org.hamcrest.Matcher<T> hasMessage(
            String expectedMessage) {
        return new ExceptionMessageMatcher<>(expectedMessage);
    }
719899
@Programmatic // for use by fixtures
    public Gmap3ToDoItem newToDo(
            final String description, 
            final String userName) {
        final Gmap3ToDoItem toDoItem = repositoryService.instantiate(Gmap3ToDoItem.class);
        toDoItem.setDescription(description);
        toDoItem.setOwnedBy(userName);

         toDoItem.setLocation(
            new Location(51.5172+random(-0.05, +0.05), 0.1182 + random(-0.05, +0.05)));
        
        repositoryService.persistAndFlush(toDoItem);

        return toDoItem;
    }
690421
public void readSketchMetadata(Callback<SketchMetadata> callback) {
        addCallback(BeanMessageID.BL_GET_META, callback);
        sendMessageWithoutPayload(BeanMessageID.BL_GET_META);
    }
1259649
public static String description(int[] hashes, int m_hashMismatchPos) {
        assert(hashes != null);
        assert(hashes.length >= 3);
        StringBuilder sb = new StringBuilder();

        sb.append("Full Hash ").append(hashes[0]);
        sb.append(", Catalog Version ").append(hashes[1]);
        sb.append(", Statement Count ").append(hashes[2] / 2);

        int includedHashes = Math.min(hashes[2], MAX_HASHES_COUNT);
        int pos = 0;
        for (int i = HEADER_OFFSET; i < HEADER_OFFSET + includedHashes; i += 2) {
            sb.append("\n  Ran Statement ").append(hashes[i]);
            sb.append(" with Parameters ").append(hashes[i + 1]);
            if(pos == m_hashMismatchPos) {
                sb.append(" <--- ALERT: Hash mismatch starts from here!");
            }
            pos++;
        }
        if (hashes[2] > MAX_HASHES_COUNT) {
            sb.append("\n  Additional SQL statements truncated.");
            if (m_hashMismatchPos == DeterminismHash.HASH_NOT_INCLUDE) {
                sb.append("\n  The mismatched hash is also truncated. "
                        + "For debugging purpose, use VOLTDB_OPTS=\"-DMAX_STATEMENTS_WITH_DETAIL=<hashcount>\" to set to a higher value, "
                        + "it could impact performance.");
            }
        }
        return sb.toString();
    }