[Japi-cvs] SF.net SVN: japi: [590] libs/swing-action/trunk/src/test/net/sf/japi/swing/ ActionBuild
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2007-08-23 08:39:46
|
Revision: 590 http://japi.svn.sourceforge.net/japi/?rev=590&view=rev Author: christianhujer Date: 2007-08-23 01:39:39 -0700 (Thu, 23 Aug 2007) Log Message: ----------- Added unit test for ActionBuilderFactory. Added Paths: ----------- libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java Added: libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java =================================================================== --- libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java (rev 0) +++ libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java 2007-08-23 08:39:39 UTC (rev 590) @@ -0,0 +1,50 @@ +/* + * JAPI libs-swing-action is a library for creating and managing javax.swing.Action objects. + * Copyright (C) 2007 Christian Hujer. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package test.net.sf.japi.swing; + +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; +import net.sf.japi.swing.DefaultActionBuilder; +import org.junit.Assert; +import org.junit.Test; + +/** Test for {@link ActionBuilderFactory}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class ActionBuilderFactoryTest { + + /** Tests that {@link ActionBuilderFactory#getInstance()} returns the same instance upon two invocations. */ + @Test + public void testGetInstanceIdentity() { + final ActionBuilderFactory instance1 = ActionBuilderFactory.getInstance(); + final ActionBuilderFactory instance2 = ActionBuilderFactory.getInstance(); + Assert.assertSame("Two invocations of ActionBuilderFactory.getInstance() must return the same instance.", instance1, instance2); + } + + /** Tests that {@link ActionBuilderFactory#getActionBuilder(String)} and {@link ActionBuilderFactory#putActionBuilder(String, ActionBuilder)} work. */ + @Test + public void testGetAndPut() { + final ActionBuilderFactory testling = new ActionBuilderFactory() {}; + final ActionBuilder object = new DefaultActionBuilder(); + testling.putActionBuilder("foo", object); + Assert.assertSame("Stored ActionBuilder must be retrievable under its basename.", object, testling.getActionBuilder("foo")); + } + +} // class ActionBuilderFactoryTest Property changes on: libs/swing-action/trunk/src/test/net/sf/japi/swing/ActionBuilderFactoryTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |