1  /**
     2   * Copyright the original author or authors.
     3   * 
     4   * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   * 
     8   *      http://www.mozilla.org/MPL/MPL-1.1.html
     9   * 
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  import org.as2lib.core.BasicInterface;
    18  import org.as2lib.test.mock.MethodBehavior;
    19  import org.as2lib.test.mock.MethodCall;
    20  
    21  /**
    22   * {@code Behavior} stores expected behaviors and exposes them for verification.
    23   * 
    24   * @author Simon Wacker
    25   */
    26  interface org.as2lib.test.mock.Behavior extends BasicInterface {
    27  	
    28  	/**
    29  	 * Adds the given {@code methodBehavior} behavior for the passed-in
    30  	 * {@code methodName}.
    31  	 *
    32  	 * @param methodName the name of the method to register the {@code methodBehavior}
    33  	 * with
    34  	 * @param methodBehavior the method behavior to register
    35  	 */
    36  	public function addMethodBehavior(methodName:String, methodBehavior:MethodBehavior):Void;
    37  	
    38  	/**
    39  	 * Creates a new method behavior for the passed-in {@code expectedMethodCall}.
    40  	 *
    41  	 * @param expectedMethodCall the method call to create a behavior for
    42  	 * @return the created method behavior
    43  	 */
    44  	public function createMethodBehavior(expectedMethodCall:MethodCall):MethodBehavior;
    45  	
    46  	/**
    47  	 * Returns a method behavior that matches the given {@code actualMethodCall}.
    48  	 *
    49  	 * @return a matching method behavior
    50  	 */
    51  	public function getMethodBehavior(actualMethodCall:MethodCall):MethodBehavior;
    52  	
    53  	/**
    54  	 * Returns the lastly added method behavior.
    55  	 *
    56  	 * @return the lastly added method behavior
    57  	 */
    58  	public function getLastMethodBehavior(Void):MethodBehavior;
    59  	
    60  	/**
    61  	 * Removes all added behaviors.
    62  	 */
    63  	public function removeAllBehaviors(Void):Void;
    64  	
    65  	/**
    66  	 * Verifies all added behaviors.
    67  	 */
    68  	public function verify(Void):Void;
    69  	
    70  }