[Seasar-user:16613] Re: S2UnitのMockInterceptorについて
    Koichi Kobayashi
    [E-MAIL ADDRESS DELETED]
       
    2009年 1月  7日 (水) 19:30:08 JST
    
    
  
小林 (koichik) です.
Date:    Wed, 7 Jan 2009 19:10:48 +0900
From:    aaa aaa <[E-MAIL ADDRESS DELETED]>
To:      <[E-MAIL ADDRESS DELETED]>
Subject: [Seasar-user:16612]  RE:  Re: S2UnitのMockInterceptorについて
> ということは、exec→testMethodという呼び出しを行っているものが
> あって、testMethodをMock化して例外試験を行うということはできないのでしょうか?
MockInterceptor#createProxy() を使わずに
ポイントカットを指定すれば可能です.
ポイントカットを指定するには dicon を
使うのが簡単です.
<component class="...Logic">
  <aspect pointcut="testMethod">
    <component class="org.seasar.framework.aop.interceptors.MockInterceptor">
      <initMethod name="setThrowable">
        <arg>"testMethod"</arg>
        <arg>new Exception()</arg>
      </initMethod>
    </component>
  </aspect>
</component>
この場合は testMethod() にだけ MockInterceptor が
適用されるので,exec() メソッドは通常通りに
呼び出されます.
-- 
<component name="koichik">
    <property name="fullName">"Koichi Kobayashi"</property>
    <property name="email">"[E-MAIL ADDRESS DELETED]"</property>
    <property name="blog">"http://d.hatena.ne.jp/koichik"</property>
</component>
    
    
Seasar-user メーリングリストの案内