Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1554 - in development/laboratory/planet/components/fsm/basic/src: main/net/dpml/fsm/basic test test/net test/net/dpml test/net/dpml/fsm test/net/dpml/fsm/basic test/net/dpml/fsm/basic/test

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1554 - in development/laboratory/planet/components/fsm/basic/src: main/net/dpml/fsm/basic test test/net test/net/dpml test/net/dpml/fsm test/net/dpml/fsm/basic test/net/dpml/fsm/basic/test
  • Date: Sat, 22 Jan 2005 06:55:23 +0100

Author: niclas
Date: Sat Jan 22 06:55:23 2005
New Revision: 1554

Added:
development/laboratory/planet/components/fsm/basic/src/test/
development/laboratory/planet/components/fsm/basic/src/test/net/
development/laboratory/planet/components/fsm/basic/src/test/net/dpml/
development/laboratory/planet/components/fsm/basic/src/test/net/dpml/fsm/

development/laboratory/planet/components/fsm/basic/src/test/net/dpml/fsm/basic/

development/laboratory/planet/components/fsm/basic/src/test/net/dpml/fsm/basic/test/

development/laboratory/planet/components/fsm/basic/src/test/net/dpml/fsm/basic/test/CommandRuleImplTestCase.java
(contents, props changed)
Modified:

development/laboratory/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/CommandRuleImpl.java
Log:
Added a testcase for CommandRuleImpl, and found incorrect signature in
constructor.

Modified:
development/laboratory/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/CommandRuleImpl.java
==============================================================================
---
development/laboratory/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/CommandRuleImpl.java
(original)
+++
development/laboratory/planet/components/fsm/basic/src/main/net/dpml/fsm/basic/CommandRuleImpl.java
Sat Jan 22 06:55:23 2005
@@ -19,8 +19,6 @@
package net.dpml.fsm.basic;

import net.dpml.lang.NullArgumentException;
-import net.dpml.parameters.Parameters;
-import net.dpml.parameters.ParameterException;
import net.dpml.fsm.TransitionRule;

/**
@@ -38,7 +36,7 @@
private boolean m_ignoreCase;

public CommandRuleImpl( String command, int priority, boolean ignoreCase
)
- throws ParameterException, NullArgumentException
+ throws NullArgumentException
{
if( command == null )
{

Added:
development/laboratory/planet/components/fsm/basic/src/test/net/dpml/fsm/basic/test/CommandRuleImplTestCase.java
==============================================================================
--- (empty file)
+++
development/laboratory/planet/components/fsm/basic/src/test/net/dpml/fsm/basic/test/CommandRuleImplTestCase.java
Sat Jan 22 06:55:23 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2004-2005 Niclas Hedhman.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.fsm.basic.test;
+
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import junit.framework.TestCase;
+
+import net.dpml.fsm.basic.CommandRuleImpl;
+import net.dpml.lang.NullArgumentException;
+
+public class CommandRuleImplTestCase extends TestCase
+{
+ private CommandRuleImpl m_rule;
+
+ public CommandRuleImplTestCase( String name )
+ {
+ super( name );
+ }
+
+ public void testConstructorWithNullArgument()
+ throws Exception
+ {
+ try
+ {
+ new CommandRuleImpl( null, 0, false );
+ fail( "NullArgumentException was expected, but not thrown." );
+ } catch( NullArgumentException e )
+ {
+ // expected !
+ }
+ }
+
+ public void testTransitionTestCaseSensitive()
+ {
+ CommandRuleImpl rule = new CommandRuleImpl( "test-command", 100,
false );
+ assertTrue( "Rule indicating no transition for exact match.",
rule.isTransition( "test-command" ) );
+ assertTrue( "Rule indicating transition for wrong command.", !
rule.isTransition( "test2-command" ) );
+ assertTrue( "Rule indicating transition for wrong case.", !
rule.isTransition( "tEst-command" ) );
+ }
+
+ public void testTransitionTestCaseIgnore()
+ {
+ CommandRuleImpl rule = new CommandRuleImpl( "test-command", 100,
true );
+ assertTrue( "Rule indicating no transition for exact match.",
rule.isTransition( "test-command" ) );
+ assertTrue( "Rule indicating transition for wrong command.", !
rule.isTransition( "test2-command" ) );
+ assertTrue( "Rule indicating no transition for mixed case.",
rule.isTransition( "tEst-commanD" ) );
+ }
+
+ public void testPriority()
+ {
+ CommandRuleImpl rule1 = new CommandRuleImpl( "test-command", 100,
true );
+ CommandRuleImpl rule2 = new CommandRuleImpl( "test2-command", 100,
true );
+ CommandRuleImpl rule3 = new CommandRuleImpl( "test3-command", 101,
true );
+ assertEquals( 0, rule1.compareTo( rule2 ) );
+ assertEquals( 0, rule2.compareTo( rule1 ) );
+ SortedSet list = new TreeSet();
+ list.add( rule3 );
+ list.add( rule1 );
+ assertEquals( rule1, list.first() );
+ assertEquals( rule3, list.last() );
+ }
+}



  • svn commit: r1554 - in development/laboratory/planet/components/fsm/basic/src: main/net/dpml/fsm/basic test test/net test/net/dpml test/net/dpml/fsm test/net/dpml/fsm/basic test/net/dpml/fsm/basic/test, niclas, 01/22/2005

Archive powered by MHonArc 2.6.24.

Top of Page