View Javadoc

1   /*
2    *  soapui, copyright (C) 2005 Ole Matzura / eviware.com 
3    *
4    *  SoapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
7    *
8    *  SoapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
10   *  See the GNU Lesser General Public License for more details at gnu.org.
11   */
12  
13  package com.eviware.soapui.impl.wsdl.teststeps.assertions;
14  
15  import com.eviware.soapui.support.SoapUIException;
16  
17  /***
18   * Exception thrown during assertion
19   * 
20   * @author Ole.Matzura
21   */
22  
23  public class AssertionException extends SoapUIException
24  {
25     private com.eviware.soapui.impl.wsdl.teststeps.assertions.AssertionError[] errors;
26  
27     public AssertionException( AssertionError error )
28     {
29        this( new AssertionError[] {error});
30     }
31  
32     public AssertionException(AssertionError[] errors)
33     {
34        this.errors = errors;
35     }
36     
37     public int getErrorCount()
38     {
39        return errors.length;
40     }
41     
42     public AssertionError getErrorAt( int c )
43     {
44        return errors[c];
45     }
46  
47  	public AssertionError[] getErrors()
48  	{
49  		return errors;
50  	}
51  
52  	public String getMessage()
53  	{
54  		StringBuffer result = new StringBuffer();
55  		for( int c = 0; c < errors.length; c++ )
56  		{
57  			if( c > 0 )
58  				result.append( '\n' );
59  			result.append( errors[c].getMessage() );
60  		}
61  		
62  		return result.toString();
63  	}
64  	
65  	
66  }