// Path: java/com/google/gwt/testing/easygwtmock/client/Answer.java
// public interface Answer<T> {
// 
//   /**
//    * Is called by EasyGwtMock to answer an expected call. The answer may be to
//    * return a value, or to throw an exception. Be careful when using the methods
//    * arguments - using them is not refactoring-safe.
//    * 
//    * @return the value to be returned
//    * @throws Throwable
//    *             the throwable to be thrown
//    */
//   T answer(Object[] args) throws Throwable;
// }
// 
// Path: java/com/google/gwt/testing/easygwtmock/client/ArgumentMatcher.java
// public interface ArgumentMatcher {
//   /**
//    * Returns true if this matcher accepts the given argument.
//    * <p>
//    * Like Object.equals(), it should be aware that the argument passed might
//    * be null and of any type. So you will usually start the method with an
//    * instanceof and/or null check.
//    * <p>
//    * The method should <b>never</b> assert if the argument doesn't match. It
//    * should only return false. EasyGwtMock will take care of asserting if the
//    * call is really unexpected.
//    */
//   boolean matches(Object argument);
// 
//   /**
//    * Appends a string representation of this matcher to the given buffer. In
//    * case of failure, the printed message will show this string to allow to
//    * know which matcher was used for the failing call.
//    */
//   void appendTo(StringBuffer buffer);
// }
// 
// Path: java/com/google/gwt/testing/easygwtmock/client/ExpectationSetters.java
// public interface ExpectationSetters<T> {
// 
//   /**
//    * Sets a return value that will be returned for the expected invocation.
//    */
//   ExpectationSetters<T> andReturn(T value);
//   
//   /**
//    * Sets a throwable that will be thrown for the expected invocation.
//    */
//   ExpectationSetters<T> andThrow(Throwable throwable);
//   
//   /**
//    * Calls the onSuccess() method of a {@link com.google.gwt.user.client.rpc.AsyncCallback}
//    * object, which is provided as argument to the expected invocation.
//    * 
//    * @param result
//    *            is passed to the onSuccess() method
//    */
//   ExpectationSetters<Object> andCallOnSuccess(Object result);
//   
//   /**
//    * Calls the onFailure() method of a {@link com.google.gwt.user.client.rpc.AsyncCallback}
//    * object, which is provided as argument to the expected invocation.
//    * 
//    * @param caught
//    *            is passed to the onFailure() method
//    */
//   ExpectationSetters<Object> andCallOnFailure(Throwable caught);
// 
//   /**
//    * Sets an object that will be used to calculate the answer for the expected
//    * invocation (either return a value, or throw an exception).
//    */
//   ExpectationSetters<T> andAnswer(Answer<? extends T> answer);
// 
//   /**
//    * Expect the last invocation <code>count</code> times.
//    */
//   ExpectationSetters<T> times(int count);
// 
//   /**
//    * Expect the last invocation between <code>min</code> and <code>max</code>
//    * times.
//    */
//   ExpectationSetters<T> times(int min, int max);
// 
//   /**
//    * Expect the last invocation once. This is the default.
//    */
//   ExpectationSetters<T> once();
// 
//   /**
//    * Expect the last invocation at least once.
//    */
//   ExpectationSetters<T> atLeastOnce();
// 
//   /**
//    * Expect the last invocation any times.
//    */
//   ExpectationSetters<T> anyTimes();
// }
// 
// Path: java/com/google/gwt/testing/easygwtmock/client/internal/matchers/ArgumentCapture.java
// public class ArgumentCapture implements ArgumentMatcher {
// 
//   private Capture<? extends Object> capture;
//   private Object potentialValue;
//   
//   public ArgumentCapture(Capture<? extends Object> capture) {
//     this.capture = capture;
//   }
//   
//   @Override
//   public boolean matches(Object argument) {
//     this.potentialValue = argument;
//     return true;
//   }
// 
//   @Override
//   public void appendTo(StringBuffer buffer) {
//     buffer.append("captured(").append(this.capture).append(")");
//   }
//   
//   public void captureArgument() {
//     this.capture.captureValue(this.potentialValue);
//   }
// }


import com.google.gwt.testing.easygwtmock.client.Answer;
import com.google.gwt.testing.easygwtmock.client.ArgumentMatcher;
import com.google.gwt.testing.easygwtmock.client.ExpectationSetters;
import com.google.gwt.testing.easygwtmock.client.internal.matchers.ArgumentCapture;
/*
 * Copyright 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.google.gwt.testing.easygwtmock.client.internal;


/**
 * An object representing the replay state.
 * 
 * @author Michael Goderbauer
 */
public class ReplayState implements MocksControlState {

  private MocksBehavior behavior;
  
  ReplayState(MocksBehavior behavior) {
    this.behavior = behavior;
  }
  
  @Override
  public ExpectationSetters<Object> getExpectationSetter() throws IllegalStateExceptionWrapper {
    throw new IllegalStateExceptionWrapper(
// Path: java/com/google/gwt/testing/easygwtmock/client/Answer.java
// public interface Answer<T> {
// 
//   /**
//    * Is called by EasyGwtMock to answer an expected call. The answer may be to
//    * return a value, or to throw an exception. Be careful when using the methods
//    * arguments - using them is not refactoring-safe.
//    * 
//    * @return the value to be returned
//    * @throws Throwable
//    *             the throwable to be thrown
//    */
//   T answer(Object[] args) throws Throwable;
// }
// 
// Path: java/com/google/gwt/testing/easygwtmock/client/ArgumentMatcher.java
// public interface ArgumentMatcher {
//   /**
//    * Returns true if this matcher accepts the given argument.
//    * <p>
//    * Like Object.equals(), it should be aware that the argument passed might
//    * be null and of any type. So you will usually start the method with an
//    * instanceof and/or null check.
//    * <p>
//    * The method should <b>never</b> assert if the argument doesn't match. It
//    * should only return false. EasyGwtMock will take care of asserting if the
//    * call is really unexpected.
//    */
//   boolean matches(Object argument);
// 
//   /**
//    * Appends a string representation of this matcher to the given buffer. In
//    * case of failure, the printed message will show this string to allow to
//    * know which matcher was used for the failing call.
//    */
//   void appendTo(StringBuffer buffer);
// }
// 
// Path: java/com/google/gwt/testing/easygwtmock/client/ExpectationSetters.java
// public interface ExpectationSetters<T> {
// 
//   /**
//    * Sets a return value that will be returned for the expected invocation.
//    */
//   ExpectationSetters<T> andReturn(T value);
//   
//   /**
//    * Sets a throwable that will be thrown for the expected invocation.
//    */
//   ExpectationSetters<T> andThrow(Throwable throwable);
//   
//   /**
//    * Calls the onSuccess() method of a {@link com.google.gwt.user.client.rpc.AsyncCallback}
//    * object, which is provided as argument to the expected invocation.
//    * 
//    * @param result
//    *            is passed to the onSuccess() method
//    */
//   ExpectationSetters<Object> andCallOnSuccess(Object result);
//   
//   /**
//    * Calls the onFailure() method of a {@link com.google.gwt.user.client.rpc.AsyncCallback}
//    * object, which is provided as argument to the expected invocation.
//    * 
//    * @param caught
//    *            is passed to the onFailure() method
//    */
//   ExpectationSetters<Object> andCallOnFailure(Throwable caught);
// 
//   /**
//    * Sets an object that will be used to calculate the answer for the expected
//    * invocation (either return a value, or throw an exception).
//    */
//   ExpectationSetters<T> andAnswer(Answer<? extends T> answer);
// 
//   /**
//    * Expect the last invocation <code>count</code> times.
//    */
//   ExpectationSetters<T> times(int count);
// 
//   /**
//    * Expect the last invocation between <code>min</code> and <code>max</code>
//    * times.
//    */
//   ExpectationSetters<T> times(int min, int max);
// 
//   /**
//    * Expect the last invocation once. This is the default.
//    */
//   ExpectationSetters<T> once();
// 
//   /**
//    * Expect the last invocation at least once.
//    */
//   ExpectationSetters<T> atLeastOnce();
// 
//   /**
//    * Expect the last invocation any times.
//    */
//   ExpectationSetters<T> anyTimes();
// }
// 
// Path: java/com/google/gwt/testing/easygwtmock/client/internal/matchers/ArgumentCapture.java
// public class ArgumentCapture implements ArgumentMatcher {
// 
//   private Capture<? extends Object> capture;
//   private Object potentialValue;
//   
//   public ArgumentCapture(Capture<? extends Object> capture) {
//     this.capture = capture;
//   }
//   
//   @Override
//   public boolean matches(Object argument) {
//     this.potentialValue = argument;
//     return true;
//   }
// 
//   @Override
//   public void appendTo(StringBuffer buffer) {
//     buffer.append("captured(").append(this.capture).append(")");
//   }
//   
//   public void captureArgument() {
//     this.capture.captureValue(this.potentialValue);
//   }
// }


// Path: java/com/google/gwt/testing/easygwtmock/client/internal/ReplayState.java
import com.google.gwt.testing.easygwtmock.client.Answer;
import com.google.gwt.testing.easygwtmock.client.ArgumentMatcher;
import com.google.gwt.testing.easygwtmock.client.ExpectationSetters;
import com.google.gwt.testing.easygwtmock.client.internal.matchers.ArgumentCapture;

/*
 * Copyright 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.google.gwt.testing.easygwtmock.client.internal;


/**
 * An object representing the replay state.
 * 
 * @author Michael Goderbauer
 */
public class ReplayState implements MocksControlState {

  private MocksBehavior behavior;
  
  ReplayState(MocksBehavior behavior) {
    this.behavior = behavior;
  }
  
  @Override
  public ExpectationSetters<Object> getExpectationSetter() throws IllegalStateExceptionWrapper {
    throw new IllegalStateExceptionWrapper(
      new IllegalStateException("Cannot set expectations while in replay state"));