|
From: <th...@us...> - 2008-12-31 23:47:21
|
Revision: 8768
http://pcgen.svn.sourceforge.net/pcgen/?rev=8768&view=rev
Author: thpr
Date: 2008-12-31 23:47:18 +0000 (Wed, 31 Dec 2008)
Log Message:
-----------
Kit Token Tests, part 3
Added Paths:
-----------
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/AbilityTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/CountTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FeatTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FreeTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/ClassTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/LevelTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/SubClassTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/CountTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DeityTokenTest.java
Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DomainTokenTest.java
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/AbilityTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/AbilityTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/AbilityTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.ability;
+
+import org.junit.Test;
+
+import pcgen.core.Ability;
+import pcgen.core.AbilityCategory;
+import pcgen.core.kit.KitAbilities;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class AbilityTokenTest extends AbstractSubTokenTestCase<KitAbilities>
+{
+
+ static AbilityToken token = new AbilityToken();
+ static CDOMSubLineLoader<KitAbilities> loader = new CDOMSubLineLoader<KitAbilities>(
+ "*KITTOKEN", "SKILL", KitAbilities.class);
+
+ @Override
+ public Class<KitAbilities> getCDOMClass()
+ {
+ return KitAbilities.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitAbilities> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitAbilities> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("CATEGORY=Feat|Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class,
+ "Fireball");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref
+ .constructCDOMObject(Ability.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("CATEGORY=Feat|Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class,
+ "Fireball");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref
+ .constructCDOMObject(Ability.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = primaryContext.ref.constructCDOMObject(Ability.class, "English");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref.constructCDOMObject(Ability.class, "English");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("CATEGORY=Feat|English" + getJoinCharacter() + "Fireball");
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ assertFalse(parse("CATEGORY=Feat|TestWP1" + getJoinCharacter()));
+ }
+
+ private char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ assertFalse(parse("CATEGORY=Feat|" + getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ assertFalse(parse("CATEGORY=Feat|TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/CountTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/CountTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/CountTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.ability;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitAbilities;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class CountTokenTest extends AbstractSubTokenTestCase<KitAbilities>
+{
+
+ static CountToken token = new CountToken();
+ static CDOMSubLineLoader<KitAbilities> loader = new CDOMSubLineLoader<KitAbilities>(
+ "*KITTOKEN", "SPELLS", KitAbilities.class);
+
+ @Override
+ public Class<KitAbilities> getCDOMClass()
+ {
+ return KitAbilities.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitAbilities> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitAbilities> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testInvalidInputFormula() throws PersistenceLayerException
+ {
+ assertFalse(parse("FormulaProhibited"));
+ }
+
+ @Test
+ public void testInvalidInputZero() throws PersistenceLayerException
+ {
+ assertFalse(parse("0"));
+ }
+
+ @Test
+ public void testInvalidInputNegative() throws PersistenceLayerException
+ {
+ assertFalse(parse("-1"));
+ }
+
+ @Test
+ public void testInvalidInputDecimal() throws PersistenceLayerException
+ {
+ assertFalse(parse("1.5"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FeatTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FeatTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FeatTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.ability;
+
+import org.junit.Test;
+
+import pcgen.core.Ability;
+import pcgen.core.AbilityCategory;
+import pcgen.core.kit.KitAbilities;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class FeatTokenTest extends AbstractSubTokenTestCase<KitAbilities>
+{
+
+ static FeatToken token = new FeatToken();
+ static CDOMSubLineLoader<KitAbilities> loader = new CDOMSubLineLoader<KitAbilities>(
+ "*KITTOKEN", "SKILL", KitAbilities.class);
+
+ @Override
+ public Class<KitAbilities> getCDOMClass()
+ {
+ return KitAbilities.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitAbilities> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitAbilities> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class,
+ "Fireball");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref
+ .constructCDOMObject(Ability.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ Ability ab = primaryContext.ref.constructCDOMObject(Ability.class,
+ "Fireball");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref
+ .constructCDOMObject(Ability.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = primaryContext.ref.constructCDOMObject(Ability.class, "English");
+ primaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ ab = secondaryContext.ref.constructCDOMObject(Ability.class, "English");
+ secondaryContext.ref.reassociateCategory(AbilityCategory.FEAT, ab);
+ runRoundRobin("English" + getJoinCharacter() + "Fireball");
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1" + getJoinCharacter()));
+ }
+
+ private char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Test
+ public void testInvalidChangeCatetory() throws PersistenceLayerException
+ {
+ assertFalse(parse("CATEGORY=FEAT|TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ assertFalse(parse(getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FreeTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FreeTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/ability/FreeTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.ability;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitAbilities;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class FreeTokenTest extends AbstractSubTokenTestCase<KitAbilities>
+{
+
+ static FreeToken token = new FreeToken();
+ static CDOMSubLineLoader<KitAbilities> loader = new CDOMSubLineLoader<KitAbilities>(
+ "*KITTOKEN", "SKILL", KitAbilities.class);
+
+ @Override
+ public Class<KitAbilities> getCDOMClass()
+ {
+ return KitAbilities.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitAbilities> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitAbilities> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputString() throws PersistenceLayerException
+ {
+ internalTestInvalidInputString(null);
+ }
+
+ @Test
+ public void testInvalidInputStringSet() throws PersistenceLayerException
+ {
+ assertTrue(parse("YES"));
+ assertTrue(parseSecondary("YES"));
+ assertEquals(Boolean.TRUE, getValue());
+ internalTestInvalidInputString(Boolean.TRUE);
+ }
+
+ public void internalTestInvalidInputString(Object val)
+ throws PersistenceLayerException
+ {
+ assertEquals(val, getValue());
+ assertFalse(parse("String"));
+ assertEquals(val, getValue());
+ assertFalse(parse("TYPE=TestType"));
+ assertEquals(val, getValue());
+ assertFalse(parse("TYPE.TestType"));
+ assertEquals(val, getValue());
+ assertFalse(parse("ALL"));
+ assertEquals(val, getValue());
+ assertFalse(parse("Yo!"));
+ assertEquals(val, getValue());
+ assertFalse(parse("Now"));
+ assertEquals(val, getValue());
+ }
+
+ @Test
+ public void testValidInputs() throws PersistenceLayerException
+ {
+ assertTrue(parse("YES"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("NO"));
+ assertEquals(Boolean.FALSE, getValue());
+ // We're nice enough to be case insensitive here...
+ assertTrue(parse("YeS"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("Yes"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("No"));
+ assertEquals(Boolean.FALSE, getValue());
+ // Allow abbreviations
+ assertTrue(parse("Y"));
+ assertEquals(Boolean.TRUE, getValue());
+ assertTrue(parse("N"));
+ assertEquals(Boolean.FALSE, getValue());
+ }
+
+ private Boolean getValue()
+ {
+ return primaryProf.getFree();
+ }
+
+ @Test
+ public void testRoundRobinYes() throws PersistenceLayerException
+ {
+ runRoundRobin("YES");
+ }
+
+ @Test
+ public void testRoundRobinNo() throws PersistenceLayerException
+ {
+ runRoundRobin("NO");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/ClassTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/ClassTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/ClassTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.clazz;
+
+import org.junit.Test;
+
+import pcgen.core.PCClass;
+import pcgen.core.kit.KitClass;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class ClassTokenTest extends AbstractSubTokenTestCase<KitClass>
+{
+
+ static ClassToken token = new ClassToken();
+ static CDOMSubLineLoader<KitClass> loader = new CDOMSubLineLoader<KitClass>(
+ "*KITTOKEN", "SKILL", KitClass.class);
+
+ @Override
+ public Class<KitClass> getCDOMClass()
+ {
+ return KitClass.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitClass> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitClass> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputOnlyOne() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(PCClass.class, "English");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "English");
+ assertTrue(parse("Fireball,English"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/LevelTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/LevelTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/LevelTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.clazz;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitClass;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class LevelTokenTest extends AbstractSubTokenTestCase<KitClass>
+{
+
+ static LevelToken token = new LevelToken();
+ static CDOMSubLineLoader<KitClass> loader = new CDOMSubLineLoader<KitClass>(
+ "*KITTOKEN", "SPELLS", KitClass.class);
+
+ @Override
+ public Class<KitClass> getCDOMClass()
+ {
+ return KitClass.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitClass> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitClass> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testRoundRobinFormula() throws PersistenceLayerException
+ {
+ runRoundRobin("Formula");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/SubClassTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/SubClassTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/clazz/SubClassTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.clazz;
+
+import java.net.URISyntaxException;
+
+import org.junit.Test;
+
+import pcgen.cdom.enumeration.SubClassCategory;
+import pcgen.core.PCClass;
+import pcgen.core.SubClass;
+import pcgen.core.kit.KitClass;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class SubClassTokenTest extends AbstractSubTokenTestCase<KitClass>
+{
+
+ static SubclassToken token = new SubclassToken();
+ static CDOMSubLineLoader<KitClass> loader = new CDOMSubLineLoader<KitClass>(
+ "*KITTOKEN", "SKILL", KitClass.class);
+
+ @Override
+ public void setUp() throws PersistenceLayerException, URISyntaxException
+ {
+ super.setUp();
+ primaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ secondaryContext.ref.constructCDOMObject(PCClass.class, "Wizard");
+ primaryProf.setPcclass(primaryContext.ref.getCDOMReference(
+ PCClass.class, "Wizard"));
+ secondaryProf.setPcclass(secondaryContext.ref.getCDOMReference(
+ PCClass.class, "Wizard"));
+ }
+
+ @Override
+ public Class<KitClass> getCDOMClass()
+ {
+ return KitClass.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitClass> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitClass> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputOnlyOne() throws PersistenceLayerException
+ {
+ SubClassCategory cat = SubClassCategory.getConstant("Wizard");
+ SubClass sc = primaryContext.ref.constructCDOMObject(SubClass.class, "Fireball");
+ primaryContext.ref.reassociateCategory(cat, sc);
+ sc = secondaryContext.ref.constructCDOMObject(SubClass.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(cat, sc);
+ sc = primaryContext.ref.constructCDOMObject(SubClass.class, "English");
+ primaryContext.ref.reassociateCategory(cat, sc);
+ sc = secondaryContext.ref.constructCDOMObject(SubClass.class, "English");
+ secondaryContext.ref.reassociateCategory(cat, sc);
+ assertTrue(parse("Fireball,English"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ SubClassCategory cat = SubClassCategory.getConstant("Wizard");
+ SubClass sc = primaryContext.ref.constructCDOMObject(SubClass.class, "Fireball");
+ primaryContext.ref.reassociateCategory(cat, sc);
+ sc = secondaryContext.ref.constructCDOMObject(SubClass.class, "Fireball");
+ secondaryContext.ref.reassociateCategory(cat, sc);
+ runRoundRobin("Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/CountTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/CountTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/CountTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.deity;
+
+import org.junit.Test;
+
+import pcgen.core.kit.KitDeity;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class CountTokenTest extends AbstractSubTokenTestCase<KitDeity>
+{
+
+ static CountToken token = new CountToken();
+ static CDOMSubLineLoader<KitDeity> loader = new CDOMSubLineLoader<KitDeity>(
+ "*KITTOKEN", "SPELLS", KitDeity.class);
+
+ @Override
+ public Class<KitDeity> getCDOMClass()
+ {
+ return KitDeity.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitDeity> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitDeity> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testRoundRobinNumber() throws PersistenceLayerException
+ {
+ runRoundRobin("3");
+ }
+
+ @Test
+ public void testRoundRobinFormula() throws PersistenceLayerException
+ {
+ runRoundRobin("Formula");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DeityTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DeityTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DeityTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.deity;
+
+import org.junit.Test;
+
+import pcgen.core.Deity;
+import pcgen.core.kit.KitDeity;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class DeityTokenTest extends AbstractSubTokenTestCase<KitDeity>
+{
+
+ static DeityToken token = new DeityToken();
+ static CDOMSubLineLoader<KitDeity> loader = new CDOMSubLineLoader<KitDeity>(
+ "*KITTOKEN", "SKILL", KitDeity.class);
+
+ @Override
+ public Class<KitDeity> getCDOMClass()
+ {
+ return KitDeity.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitDeity> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitDeity> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testInvalidInputOnlyOne() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Deity.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Deity.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(Deity.class, "English");
+ secondaryContext.ref.constructCDOMObject(Deity.class, "English");
+ assertTrue(parse("Fireball,English"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Deity.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Deity.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+}
Added: Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DomainTokenTest.java
===================================================================
--- Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DomainTokenTest.java (rev 0)
+++ Trunk/pcgen/code/src/utest/plugin/lsttokens/kit/deity/DomainTokenTest.java 2008-12-31 23:47:18 UTC (rev 8768)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007 Tom Parker <th...@us...>
+ *
+ * This program 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 program 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 plugin.lsttokens.kit.deity;
+
+import org.junit.Test;
+
+import pcgen.core.Domain;
+import pcgen.core.kit.KitDeity;
+import pcgen.persistence.PersistenceLayerException;
+import pcgen.rules.persistence.CDOMSubLineLoader;
+import pcgen.rules.persistence.token.CDOMSecondaryToken;
+import plugin.lsttokens.testsupport.AbstractSubTokenTestCase;
+
+public class DomainTokenTest extends AbstractSubTokenTestCase<KitDeity>
+{
+
+ static DomainToken token = new DomainToken();
+ static CDOMSubLineLoader<KitDeity> loader = new CDOMSubLineLoader<KitDeity>(
+ "*KITTOKEN", "SKILL", KitDeity.class);
+
+ @Override
+ public Class<KitDeity> getCDOMClass()
+ {
+ return KitDeity.class;
+ }
+
+ @Override
+ public CDOMSubLineLoader<KitDeity> getLoader()
+ {
+ return loader;
+ }
+
+ @Override
+ public CDOMSecondaryToken<KitDeity> getToken()
+ {
+ return token;
+ }
+
+ @Test
+ public void testInvalidInputEmptyCount() throws PersistenceLayerException
+ {
+ assertTrue(parse("Fireball"));
+ assertFalse(primaryContext.ref.validate());
+ }
+
+ @Test
+ public void testRoundRobinSimple() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Domain.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Domain.class, "Fireball");
+ runRoundRobin("Fireball");
+ }
+
+ @Test
+ public void testRoundRobinTwo() throws PersistenceLayerException
+ {
+ primaryContext.ref.constructCDOMObject(Domain.class, "Fireball");
+ secondaryContext.ref.constructCDOMObject(Domain.class, "Fireball");
+ primaryContext.ref.constructCDOMObject(Domain.class, "English");
+ secondaryContext.ref.constructCDOMObject(Domain.class, "English");
+ runRoundRobin("Fireball" + getJoinCharacter() + "English");
+ }
+
+ @Test
+ public void testInvalidListEnd() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP1" + getJoinCharacter()));
+ }
+
+ private char getJoinCharacter()
+ {
+ return '|';
+ }
+
+ @Test
+ public void testInvalidListStart() throws PersistenceLayerException
+ {
+ assertFalse(parse(getJoinCharacter() + "TestWP1"));
+ }
+
+ @Test
+ public void testInvalidListDoubleJoin() throws PersistenceLayerException
+ {
+ assertFalse(parse("TestWP2" + getJoinCharacter() + getJoinCharacter()
+ + "TestWP1"));
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|