1 /*
2 * jDTAUS Banking SPI
3 * Copyright (C) 2005 Christian Schulte
4 * <cs@schulte.it>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21 package org.jdtaus.banking.spi.test;
22
23 import java.util.Date;
24 import java.util.Locale;
25 import junit.framework.TestCase;
26 import org.jdtaus.banking.Textschluessel;
27 import org.jdtaus.banking.spi.IllegalTextschluesselException;
28 import org.jdtaus.banking.spi.UnsupportedCurrencyException;
29 import org.jdtaus.core.text.Message;
30
31 /**
32 * Testcase for testing instantiation of various exception classes.
33 *
34 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
35 * @version $JDTAUS: ExceptionsTest.java 8723 2012-10-04 20:09:53Z schulte $
36 */
37 public class ExceptionsTest extends TestCase
38 {
39 //--Tests-------------------------------------------------------------------
40
41 public void testExceptionInstantiation() throws Exception
42 {
43 final Message msg = new Message()
44 {
45
46 public Object[] getFormatArguments( final Locale locale )
47 {
48 return new Object[ 0 ];
49 }
50
51 public String getText( final Locale locale )
52 {
53 return this.getClass().getName();
54 }
55
56 };
57
58 System.out.println(
59 new UnsupportedCurrencyException( "EUR", new Date() ).getMessage() );
60
61 final IllegalTextschluesselException e =
62 new IllegalTextschluesselException();
63
64 e.addMessage( msg );
65 e.addMessage( Textschluessel.PROP_DEBIT, msg );
66 e.addMessage( Textschluessel.PROP_EXTENSION, msg );
67 e.addMessage( Textschluessel.PROP_KEY, msg );
68 e.addMessage( Textschluessel.PROP_REMITTANCE, msg );
69 e.addMessage( Textschluessel.PROP_SHORTDESCRIPTION, msg );
70 e.addMessage( Textschluessel.PROP_VARIABLE, msg );
71
72 System.out.println( new IllegalTextschluesselException() );
73 System.out.println( e );
74 }
75
76 //-------------------------------------------------------------------Tests--
77 }