org.unitils.mock.core
Class MockProxy<T>

java.lang.Object
  extended by org.unitils.mock.core.MockProxy<T>
Direct Known Subclasses:
PartialMockProxy

public class MockProxy<T>
extends Object


Nested Class Summary
protected  class MockProxy.InvocationHandler
           
 
Field Summary
protected  BehaviorDefiningInvocations alwaysMatchingBehaviorDefiningInvocations
           
protected  MatchingInvocationBuilder matchingInvocationBuilder
           
protected  BehaviorDefiningInvocations oneTimeMatchingBehaviorDefiningInvocations
           
protected  T proxy
           
protected  Scenario scenario
           
 
Constructor Summary
MockProxy(String mockName, Class<T> mockedType, BehaviorDefiningInvocations oneTimeMatchingBehaviorDefiningInvocations, BehaviorDefiningInvocations alwaysMatchingBehaviorDefiningInvocations, Scenario scenario, MatchingInvocationBuilder matchingInvocationBuilder)
           
 
Method Summary
protected  void assertCanExecute(MockBehavior mockBehavior, ProxyInvocation proxyInvocation, BehaviorDefiningInvocation behaviorDefiningInvocation)
          Check whether the mock behavior can applied for this invocation
protected  MockBehavior getDefaultMockBehavior(ProxyInvocation proxyInvocation)
           
protected  BehaviorDefiningInvocation getMatchingBehaviorDefiningInvocation(ProxyInvocation proxyInvocation)
           
 T getProxy()
           
protected  MockBehavior getValidMockBehavior(ProxyInvocation proxyInvocation, BehaviorDefiningInvocation behaviorDefiningInvocation)
           
protected  Object handleMockInvocation(ProxyInvocation proxyInvocation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxy

protected T proxy

oneTimeMatchingBehaviorDefiningInvocations

protected BehaviorDefiningInvocations oneTimeMatchingBehaviorDefiningInvocations

alwaysMatchingBehaviorDefiningInvocations

protected BehaviorDefiningInvocations alwaysMatchingBehaviorDefiningInvocations

scenario

protected Scenario scenario

matchingInvocationBuilder

protected MatchingInvocationBuilder matchingInvocationBuilder
Constructor Detail

MockProxy

public MockProxy(String mockName,
                 Class<T> mockedType,
                 BehaviorDefiningInvocations oneTimeMatchingBehaviorDefiningInvocations,
                 BehaviorDefiningInvocations alwaysMatchingBehaviorDefiningInvocations,
                 Scenario scenario,
                 MatchingInvocationBuilder matchingInvocationBuilder)
Method Detail

getProxy

public T getProxy()

handleMockInvocation

protected Object handleMockInvocation(ProxyInvocation proxyInvocation)
                               throws Throwable
Throws:
Throwable

getMatchingBehaviorDefiningInvocation

protected BehaviorDefiningInvocation getMatchingBehaviorDefiningInvocation(ProxyInvocation proxyInvocation)
                                                                    throws Throwable
Throws:
Throwable

getValidMockBehavior

protected MockBehavior getValidMockBehavior(ProxyInvocation proxyInvocation,
                                            BehaviorDefiningInvocation behaviorDefiningInvocation)

assertCanExecute

protected void assertCanExecute(MockBehavior mockBehavior,
                                ProxyInvocation proxyInvocation,
                                BehaviorDefiningInvocation behaviorDefiningInvocation)
Check whether the mock behavior can applied for this invocation

Parameters:
mockBehavior - The behavior to verify, not null
proxyInvocation - The invocation, not null
behaviorDefiningInvocation - The invocation that defined the behavior, not null

getDefaultMockBehavior

protected MockBehavior getDefaultMockBehavior(ProxyInvocation proxyInvocation)


Copyright © 2011. All Rights Reserved.