Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2007 Mockito contributors
  * This program is made available under the terms of the MIT License.
  */
 package org.mockito.internal.stubbing;
 
 import java.util.Queue;
 
@SuppressWarnings("unchecked")
public class StubbedInvocationMatcher extends InvocationMatcher implements Answer {
    private static final long serialVersionUID = 4919105134123672727L;
    private final Queue<Answeranswers = new ConcurrentLinkedQueue<Answer>();
    public StubbedInvocationMatcher(InvocationMatcher invocationAnswer answer) {
        super(invocation.getInvocation(), invocation.getMatchers());
        this..add(answer);
    }
    public Object answer(InvocationOnMock invocationthrows Throwable {
        //see ThreadsShareGenerouslyStubbedMockTest
        synchronized() {
            return .size() == 1 ? .peek().answer(invocation) : .poll().answer(invocation);
        }
    }
    public void addAnswer(Answer answer) {
        .add(answer);
    }
    @Override
    public String toString() {
        return super.toString() + " stubbed with: " + ;
    }
New to GrepCode? Check out our FAQ X