001// SECTION-START[License Header] 002// <editor-fold defaultstate="collapsed" desc=" Generated License "> 003/* 004 * Java Object Management and Configuration 005 * Copyright (C) Christian Schulte, 2005-206 006 * All rights reserved. 007 * 008 * Redistribution and use in source and binary forms, with or without 009 * modification, are permitted provided that the following conditions 010 * are met: 011 * 012 * o Redistributions of source code must retain the above copyright 013 * notice, this list of conditions and the following disclaimer. 014 * 015 * o Redistributions in binary form must reproduce the above copyright 016 * notice, this list of conditions and the following disclaimer in 017 * the documentation and/or other materials provided with the 018 * distribution. 019 * 020 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 021 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 022 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 023 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, 024 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 025 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 026 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 027 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 029 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 030 * 031 * $JOMC: ObjectManagementExceptionTest.java 4588 2012-06-03 06:01:30Z schulte2005 $ 032 * 033 */ 034// </editor-fold> 035// SECTION-END 036package org.jomc.test; 037 038import java.io.IOException; 039import java.io.ObjectInputStream; 040import org.jomc.ObjectManagementException; 041import org.junit.Test; 042 043// SECTION-START[Documentation] 044// <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> 045/** 046 * Test cases for class {@code org.jomc.ObjectManagementException}. 047 * 048 * <dl> 049 * <dt><b>Identifier:</b></dt><dd>org.jomc.test.ObjectManagementExceptionTest</dd> 050 * <dt><b>Name:</b></dt><dd>JOMC API</dd> 051 * <dt><b>Abstract:</b></dt><dd>No</dd> 052 * <dt><b>Final:</b></dt><dd>Yes</dd> 053 * <dt><b>Stateless:</b></dt><dd>No</dd> 054 * </dl> 055 * 056 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0 057 * @version 1.3 058 */ 059// </editor-fold> 060// SECTION-END 061// SECTION-START[Annotations] 062// <editor-fold defaultstate="collapsed" desc=" Generated Annotations "> 063@javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" ) 064// </editor-fold> 065// SECTION-END 066public class ObjectManagementExceptionTest 067{ 068 // SECTION-START[ObjectManagementExceptionTest] 069 070 /** Constant to prefix relative resource names with. */ 071 private static final String ABSOLUTE_RESOURCE_NAME_PREFIX = "/org/jomc/test/"; 072 073 @Test 074 public final void testSerializable() throws Exception 075 { 076 ObjectInputStream in = null; 077 boolean suppressExceptionOnClose = true; 078 079 try 080 { 081 in = new ObjectInputStream( this.getClass().getResourceAsStream( 082 ABSOLUTE_RESOURCE_NAME_PREFIX + "ObjectManagementException.ser" ) ); 083 084 final ObjectManagementException e = (ObjectManagementException) in.readObject(); 085 System.out.println( e.toString() ); 086 suppressExceptionOnClose = false; 087 } 088 finally 089 { 090 try 091 { 092 if ( in != null ) 093 { 094 in.close(); 095 } 096 } 097 catch ( final IOException e ) 098 { 099 if ( !suppressExceptionOnClose ) 100 { 101 throw e; 102 } 103 } 104 } 105 } 106 107 // SECTION-END 108 // SECTION-START[Constructors] 109 // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> 110 /** Creates a new {@code ObjectManagementExceptionTest} instance. */ 111 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" ) 112 public ObjectManagementExceptionTest() 113 { 114 // SECTION-START[Default Constructor] 115 super(); 116 // SECTION-END 117 } 118 // </editor-fold> 119 // SECTION-END 120 // SECTION-START[Dependencies] 121 // SECTION-END 122 // SECTION-START[Properties] 123 // SECTION-END 124 // SECTION-START[Messages] 125 // SECTION-END 126}