1   /*
2    * $Id: UnitTestExceptionStrategy.java 10529 2008-01-25 05:58:36Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.soap.axis;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.service.DefaultServiceExceptionStrategy;
15  
16  import java.util.ArrayList;
17  import java.util.List;
18  
19  public class UnitTestExceptionStrategy extends DefaultServiceExceptionStrategy
20  {
21      /**
22       * Record all exceptions that this ExceptionStrategy handles so Unit Test
23       * can query them and make their assertions.
24       */
25      private List messagingExceptions = null;
26      
27      public UnitTestExceptionStrategy()
28      {
29          super();
30          messagingExceptions = new ArrayList();
31      }
32      
33      protected void logFatal(MuleMessage message, Throwable t)
34      {
35          logger.debug("logFatal", t);
36      }
37  
38      protected void logException(Throwable t)
39      {
40          logger.debug("logException", t);
41      }
42  
43      public void handleMessagingException(MuleMessage message, Throwable t)
44      {
45          messagingExceptions.add(t);
46          super.handleMessagingException(message, t);
47      }
48      
49      public List getMessagingExceptions()
50      {
51          return messagingExceptions;
52      }
53  }
54  
55