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: DefaultListenerTest.java 4459 2012-03-27 23:55:31Z schulte2005 $ 032 * 033 */ 034 // </editor-fold> 035 // SECTION-END 036 package org.jomc.ri.test; 037 038 import org.jomc.ri.DefaultListener; 039 import org.junit.Test; 040 import static org.junit.Assert.assertFalse; 041 import static org.junit.Assert.assertTrue; 042 043 // SECTION-START[Documentation] 044 // <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> 045 /** 046 * {@code DefaultListener} test cases. 047 * 048 * <dl> 049 * <dt><b>Identifier:</b></dt><dd>JOMC :: RI :: Tests :: Default Listener Test</dd> 050 * <dt><b>Name:</b></dt><dd>JOMC :: RI :: Tests :: Default Listener Test</dd> 051 * <dt><b>Abstract:</b></dt><dd>No</dd> 052 * <dt><b>Final:</b></dt><dd>No</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.2.2 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.2.2", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2" ) 064 // </editor-fold> 065 // SECTION-END 066 public class DefaultListenerTest extends ListenerTest 067 { 068 // SECTION-START[DefaultListenerTest] 069 070 /** {@inheritDoc} */ 071 @Override 072 public DefaultListener getListener() 073 { 074 return (DefaultListener) super.getListener(); 075 } 076 077 /** {@inheritDoc} */ 078 @Override 079 protected DefaultListener newListener() 080 { 081 return new DefaultListener(); 082 } 083 084 @Test 085 public final void testDefaultEnabled() throws Exception 086 { 087 assertTrue( DefaultListener.isDefaultEnabled() ); 088 System.setProperty( "org.jomc.ri.DefaultListener.defaultEnabled", Boolean.toString( false ) ); 089 DefaultListener.setDefaultEnabled( null ); 090 assertFalse( DefaultListener.isDefaultEnabled() ); 091 System.clearProperty( "org.jomc.ri.DefaultListener.defaultEnabled" ); 092 DefaultListener.setDefaultEnabled( null ); 093 } 094 095 @Test 096 public final void testEnabled() throws Exception 097 { 098 DefaultListener.setDefaultEnabled( null ); 099 this.getListener().setEnabled( null ); 100 assertTrue( this.getListener().isEnabled() ); 101 102 DefaultListener.setDefaultEnabled( false ); 103 this.getListener().setEnabled( null ); 104 assertFalse( this.getListener().isEnabled() ); 105 106 DefaultListener.setDefaultEnabled( null ); 107 this.getListener().setEnabled( null ); 108 } 109 110 // SECTION-END 111 // SECTION-START[Constructors] 112 // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> 113 /** Creates a new {@code DefaultListenerTest} instance. */ 114 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.2", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2" ) 115 public DefaultListenerTest() 116 { 117 // SECTION-START[Default Constructor] 118 super(); 119 // SECTION-END 120 } 121 // </editor-fold> 122 // SECTION-END 123 // SECTION-START[Dependencies] 124 // SECTION-END 125 // SECTION-START[Properties] 126 // SECTION-END 127 // SECTION-START[Messages] 128 // SECTION-END 129 }