001/* 002 * jDTAUS Banking SPI 003 * Copyright (C) 2005 Christian Schulte 004 * <cs@schulte.it> 005 * 006 * This library is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2.1 of the License, or any later version. 010 * 011 * This library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 019 * 020 */ 021package org.jdtaus.banking.spi.test; 022 023import java.util.Date; 024import java.util.Locale; 025import junit.framework.TestCase; 026import org.jdtaus.banking.Textschluessel; 027import org.jdtaus.banking.spi.IllegalTextschluesselException; 028import org.jdtaus.banking.spi.UnsupportedCurrencyException; 029import org.jdtaus.core.text.Message; 030 031/** 032 * Testcase for testing instantiation of various exception classes. 033 * 034 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 035 * @version $JDTAUS: ExceptionsTest.java 8723 2012-10-04 20:09:53Z schulte $ 036 */ 037public class ExceptionsTest extends TestCase 038{ 039 //--Tests------------------------------------------------------------------- 040 041 public void testExceptionInstantiation() throws Exception 042 { 043 final Message msg = new Message() 044 { 045 046 public Object[] getFormatArguments( final Locale locale ) 047 { 048 return new Object[ 0 ]; 049 } 050 051 public String getText( final Locale locale ) 052 { 053 return this.getClass().getName(); 054 } 055 056 }; 057 058 System.out.println( 059 new UnsupportedCurrencyException( "EUR", new Date() ).getMessage() ); 060 061 final IllegalTextschluesselException e = 062 new IllegalTextschluesselException(); 063 064 e.addMessage( msg ); 065 e.addMessage( Textschluessel.PROP_DEBIT, msg ); 066 e.addMessage( Textschluessel.PROP_EXTENSION, msg ); 067 e.addMessage( Textschluessel.PROP_KEY, msg ); 068 e.addMessage( Textschluessel.PROP_REMITTANCE, msg ); 069 e.addMessage( Textschluessel.PROP_SHORTDESCRIPTION, msg ); 070 e.addMessage( Textschluessel.PROP_VARIABLE, msg ); 071 072 System.out.println( new IllegalTextschluesselException() ); 073 System.out.println( e ); 074 } 075 076 //-------------------------------------------------------------------Tests-- 077}