update unit tests to make them less painful from command line. Fixed urls in Maven site home page

This commit is contained in:
jendave
2011-08-10 19:42:54 +00:00
parent 9ac666b6ab
commit 7746e68b98
22 changed files with 37 additions and 192 deletions

1
.gitattributes vendored
View File

@@ -9765,7 +9765,6 @@ src/test/java/forge/GuiProgressBarWindowTest.java svneol=native#text/plain
src/test/java/forge/GuiQuestFilterTest.java svneol=native#text/plain src/test/java/forge/GuiQuestFilterTest.java svneol=native#text/plain
src/test/java/forge/GuiQuestOptionsTest.java svneol=native#text/plain src/test/java/forge/GuiQuestOptionsTest.java svneol=native#text/plain
src/test/java/forge/GuiWinLoseTest.java svneol=native#text/plain src/test/java/forge/GuiWinLoseTest.java svneol=native#text/plain
src/test/java/forge/MoveTest.java svneol=native#text/plain
src/test/java/forge/PanelTest.java svneol=native#text/plain src/test/java/forge/PanelTest.java svneol=native#text/plain
src/test/java/forge/PhaseTest.java svneol=native#text/plain src/test/java/forge/PhaseTest.java svneol=native#text/plain
src/test/java/forge/ReadBoosterPackTest.java svneol=native#text/plain src/test/java/forge/ReadBoosterPackTest.java svneol=native#text/plain

View File

@@ -173,6 +173,7 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version> <version>2.9</version>
<configuration> <configuration>
<groups>fast</groups>
<testFailureIgnore>true</testFailureIgnore> <testFailureIgnore>true</testFailureIgnore>
</configuration> </configuration>
</plugin> </plugin>

View File

@@ -2,7 +2,7 @@
Maven Project Site Maven Project Site
----- -----
----- -----
2011-06-30 2011-08-10
----- -----
Forge Forge
@@ -31,7 +31,7 @@ Forge
defender, reach, and haste. Forge now also has a mana pool and supports creature enchantments. defender, reach, and haste. Forge now also has a mana pool and supports creature enchantments.
Forge runs on Windows, Linux, and Macs. You can download Forge from Forge runs on Windows, Linux, and Macs. You can download Forge from
{{{http://code.google.com/p/cardforge/downloads/list}here}}. {{{http://cardforge.org/releases/releases/}here}}.
<<Maven Project Links>> <<Maven Project Links>>
@@ -47,7 +47,7 @@ Forge
* {{{http://cardforge.org/}Main Website}} * {{{http://cardforge.org/}Main Website}}
* {{{http://svn.slightlymagic.net/forge/trunk}Source Code Repository}} * {{{http://svn.slightlymagic.net/forge/trunk}Source Code Repository}}
* {{{http://svn.slightlymagic.net/websvn/listing.php?repname=forge}Web View of Source}} * {{{http://svn.slightlymagic.net/websvn/listing.php?repname=forge}Web View of Source Code Repository}}
* {{{http://mtgrares.blogspot.com/}Original Author's Blog}} * {{{http://mtgrares.blogspot.com/}Original Author's Blog}}

View File

@@ -31,7 +31,7 @@ public class BoosterDraftAITest {
}//for outer }//for outer
}//runTestPrint() }//runTestPrint()
@Test @Test(timeOut = 5000)
public void runTest(BoosterDraftAI ai) { public void runTest(BoosterDraftAI ai) {
ReadDraftBoosterPack booster = new ReadDraftBoosterPack(); ReadDraftBoosterPack booster = new ReadDraftBoosterPack();
for (int outer = 0; outer < 1; outer++) { for (int outer = 0; outer < 1; outer++) {

View File

@@ -12,7 +12,7 @@ public class BoosterDraft_1Test {
/** /**
* *
*/ */
@Test(timeOut = 1000) @Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
public void BoosterDraft_1Test1() throws Exception { public void BoosterDraft_1Test1() throws Exception {
BoosterDraft_1 draft = new BoosterDraft_1(); BoosterDraft_1 draft = new BoosterDraft_1();
while (draft.hasNextChoice()) { while (draft.hasNextChoice()) {

View File

@@ -13,7 +13,7 @@ public class CardColorTest {
/** /**
* *
*/ */
@Test(timeOut = 1000) @Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
public void CardColorTest1() { public void CardColorTest1() {
ManaCost mc = new ManaCost("R W U"); ManaCost mc = new ManaCost("R W U");
EnumSet<Color> col = Color.ConvertManaCostToColor(mc); EnumSet<Color> col = Color.ConvertManaCostToColor(mc);

View File

@@ -1,19 +1,18 @@
package forge; package forge;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import net.slightlymagic.braids.util.ClumsyRunnable;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import forge.properties.ForgeProps;
import forge.properties.NewConstants;
import net.slightlymagic.braids.util.ClumsyRunnable;
import static net.slightlymagic.braids.util.testng.BraidsAssertFunctions.assertThrowsException; import static net.slightlymagic.braids.util.testng.BraidsAssertFunctions.assertThrowsException;
import org.testng.Assert;
import org.testng.annotations.Test;
/** /**
* Created by hand to test the CardReader class. * Created by hand to test the CardReader class.
*/ */
@@ -27,7 +26,7 @@ public class CardReaderTest implements NewConstants {
public static final int ESTIMATED_CARDS_IN_FOLDER = 9001; public static final int ESTIMATED_CARDS_IN_FOLDER = 9001;
@Test(timeOut = TEST_TIMEOUT) @Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
public final void test_ReadCard_nullMap() { public final void test_ReadCard_nullMap() {
final ClumsyRunnable withScissors = new ClumsyRunnable() { final ClumsyRunnable withScissors = new ClumsyRunnable() {
public void run() throws Exception { public void run() throws Exception {
@@ -38,7 +37,7 @@ public class CardReaderTest implements NewConstants {
assertThrowsException(NullPointerException.class, withScissors); assertThrowsException(NullPointerException.class, withScissors);
} }
@Test(timeOut = TEST_TIMEOUT) @Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
public final void test_ReadCard_nullCardsFolder() { public final void test_ReadCard_nullCardsFolder() {
final ClumsyRunnable withScissors = new ClumsyRunnable() { final ClumsyRunnable withScissors = new ClumsyRunnable() {
public void run() throws Exception { public void run() throws Exception {
@@ -50,7 +49,7 @@ public class CardReaderTest implements NewConstants {
assertThrowsException(NullPointerException.class, withScissors); assertThrowsException(NullPointerException.class, withScissors);
} }
@Test(timeOut = TEST_TIMEOUT) @Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
public final void test_ReadCard_nonexistentCardsFolder() { public final void test_ReadCard_nonexistentCardsFolder() {
final ClumsyRunnable withScissors = new ClumsyRunnable() { final ClumsyRunnable withScissors = new ClumsyRunnable() {
public void run() throws Exception { public void run() throws Exception {
@@ -64,7 +63,7 @@ public class CardReaderTest implements NewConstants {
assertThrowsException(RuntimeException.class, withScissors); assertThrowsException(RuntimeException.class, withScissors);
} }
@Test(timeOut = TEST_TIMEOUT) @Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
public final void test_ReadCard_fileNotFolder() throws IOException { public final void test_ReadCard_fileNotFolder() throws IOException {
final File tmpFile = File.createTempFile("just-a-file", ".testng.tmp"); final File tmpFile = File.createTempFile("just-a-file", ".testng.tmp");
@@ -80,7 +79,7 @@ public class CardReaderTest implements NewConstants {
assertThrowsException(RuntimeException.class, withScissors); assertThrowsException(RuntimeException.class, withScissors);
} }
@Test(timeOut = TEST_TIMEOUT) @Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
public final void test_ReadCard_findCard_zip() { public final void test_ReadCard_findCard_zip() {
final Map<String, Card> map = new HashMap<String, Card>(); final Map<String, Card> map = new HashMap<String, Card>();
final File cardsfolder = ForgeProps.getFile(CARDSFOLDER); final File cardsfolder = ForgeProps.getFile(CARDSFOLDER);
@@ -96,7 +95,7 @@ public class CardReaderTest implements NewConstants {
Assert.assertEquals(elvishWarrior.getName(), "Elvish Warrior", "name is correct"); Assert.assertEquals(elvishWarrior.getName(), "Elvish Warrior", "name is correct");
} }
@Test(timeOut = TEST_TIMEOUT) @Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
public final void test_ReadCard_findCard_nonzip() { public final void test_ReadCard_findCard_nonzip() {
final Map<String, Card> map = new HashMap<String, Card>(); final Map<String, Card> map = new HashMap<String, Card>();
final File cardsfolder = ForgeProps.getFile(CARDSFOLDER); final File cardsfolder = ForgeProps.getFile(CARDSFOLDER);

View File

@@ -12,7 +12,7 @@ public class GameActionTest {
/** /**
* <p>main.</p> * <p>main.</p>
*/ */
@Test(timeOut = 1000) @Test(groups = {"UnitTest", "fast"}, timeOut = 5000)
public void GameActionTest1() throws Exception { public void GameActionTest1() throws Exception {
System.out.println("GameActionTest"); System.out.println("GameActionTest");
GameAction gameAction = new GameAction(); GameAction gameAction = new GameAction();

View File

@@ -16,7 +16,7 @@ public class GuiBoosterDraftTest {
* *
* *
*/ */
@Test() @Test(groups = {"UnitTest", "fast"})
public void GuiBoosterDraftTest1() { public void GuiBoosterDraftTest1() {
Constant.Runtime.GameType[0] = Constant.GameType.Draft; Constant.Runtime.GameType[0] = Constant.GameType.Draft;
Constant.Runtime.HumanDeck[0] = new Deck(Constant.GameType.Sealed); Constant.Runtime.HumanDeck[0] = new Deck(Constant.GameType.Sealed);

View File

@@ -3,8 +3,6 @@ package forge;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import javax.swing.*;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: dhudson * User: dhudson
@@ -15,11 +13,10 @@ public class GuiFilterTest {
* *
* *
*/ */
@Test() @Test(groups = {"UnitTest", "fast"})
public void guiFilterTest1() { public void guiFilterTest1() {
try { try {
GuiFilter dialog = new GuiFilter(null, null); GuiFilter dialog = new GuiFilter(null, null);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true); dialog.setVisible(true);
Assert.assertNotNull(dialog); Assert.assertNotNull(dialog);
dialog.dispose(); dialog.dispose();

View File

@@ -15,7 +15,7 @@ public class GuiProgressBarWindowTest {
* *
* *
*/ */
@Test() @Test(groups = {"UnitTest", "fast"})
public void GuiProgressBarWindowTest1() { public void GuiProgressBarWindowTest1() {
try { try {
Gui_ProgressBarWindow dialog = new Gui_ProgressBarWindow(); Gui_ProgressBarWindow dialog = new Gui_ProgressBarWindow();

View File

@@ -15,7 +15,7 @@ public class GuiQuestFilterTest {
* *
* *
*/ */
@Test() @Test(groups = {"UnitTest", "fast"})
public void guiQuestFilterTest1() { public void guiQuestFilterTest1() {
try { try {
GuiQuestFilter dialog = new GuiQuestFilter(null, null); GuiQuestFilter dialog = new GuiQuestFilter(null, null);

View File

@@ -13,7 +13,7 @@ public class GuiQuestOptionsTest {
* *
* *
*/ */
@Test() @Test(groups = {"UnitTest", "fast"})
public void GuiQuestOptionsTest1() { public void GuiQuestOptionsTest1() {
Gui_QuestOptions dialog = new Gui_QuestOptions(); Gui_QuestOptions dialog = new Gui_QuestOptions();
dialog.setVisible(true); dialog.setVisible(true);

View File

@@ -1,7 +1,5 @@
package forge; package forge;
import forge.deck.Deck;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@@ -9,13 +7,13 @@ import org.testng.annotations.Test;
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: dhudson * User: dhudson
*/ */
@Test(groups = {"UnitTest"}) @Test(groups = {"UnitTest", "fast"})
public class GuiWinLoseTest { public class GuiWinLoseTest {
/** /**
* *
* *
*/ */
@Test() @Test(groups = {"UnitTest", "fast"})
public void GuiWinLoseTest1() { public void GuiWinLoseTest1() {
Gui_WinLose dialog = new Gui_WinLose(); Gui_WinLose dialog = new Gui_WinLose();
dialog.setVisible(true); dialog.setVisible(true);

View File

@@ -1,147 +0,0 @@
package forge;
import org.testng.annotations.Test;
import java.util.ArrayList;
/**
* <p>MoveTest class.</p>
*
* @author Forge
* @version $Id$
*/
@Test(groups = {"UnitTest"}, timeOut = 1000)
public class MoveTest {
class MoveConcrete extends Move {
private final int myNumber;
/**
* Constant <code>classNumber=-1</code>
*/
private int classNumber = -1;
/**
* Constant <code>array=</code>
*/
private int[] array;
/**
* Constant <code>classIndex=</code>
*/
private int classIndex;
private int myIndex = -1;
/**
* <p>Constructor for MoveTest.</p>
*
* @param i_array an array of int.
*/
public MoveConcrete(int i_array[]) {
this();
classIndex = 0;
array = i_array;
}
/**
* <p>Constructor for MoveTest.</p>
*/
public MoveConcrete() {
myNumber = classNumber;
classNumber++;
}
/**
* <p>Getter for the field <code>classNumber</code>.</p>
*
* @return a int.
*/
public int getClassNumber() {
return classNumber;
}
/**
* <p>Getter for the field <code>myNumber</code>.</p>
*
* @return a int.
*/
public int getMyNumber() {
return myNumber;
}
/**
* {@inheritDoc}
*/
@Override
public Move[] generateMoves() {
ArrayList<MoveTest> list = new ArrayList<MoveTest>();
for (int i = 0; i < 2; i++)
list.add(new MoveTest());
Move m[] = new Move[list.size()];
list.toArray(m);
return m;
}
/**
* {@inheritDoc}
*/
@Override
public int getScore() {
if (myIndex == -1) {
myIndex = classIndex;
classIndex++;
}
return array[myIndex];
}//getScore()
}
//branching 2
//fully test depths 1 and 2, one test of depth 3
/**
* <p>test.</p>
*/
@Test(timeOut = 1000)
public void MoveTest1() {
MoveConcrete t;
t = new MoveConcrete(new int[]{4, 1, 6, 3, 2, 7, 6, 9});
test("1", t.max(t, 3, true) == 7);
t = new MoveConcrete(new int[]{1, 2});
test("2", t.max(t, 1, true) == 2);
t = new MoveConcrete(new int[]{2, 1});
test("3", t.max(t, 1, true) == 2);
t = new MoveConcrete(new int[]{1, 2, 3, 4});
test("4", t.max(t, 2, true) == 3);
t = new MoveConcrete(new int[]{2, 1, 4, 3});
test("5", t.max(t, 2, true) == 3);
t = new MoveConcrete(new int[]{4, 3, 1, 2});
test("6", t.max(t, 2, true) == 3);
t = new MoveConcrete(new int[]{3, 4, 2, 1});
test("7", t.max(t, 2, true) == 3);
}
/**
* <p>test.</p>
*
* @param message a {@link java.lang.String} object.
* @param shouldBeTrue a boolean.
*/
public void test(String message, boolean shouldBeTrue) {
if (!shouldBeTrue) {
throw new RuntimeException(message);
}
}
}

View File

@@ -12,7 +12,7 @@ public class PhaseTest {
* *
* *
*/ */
@Test(timeOut = 5000, enabled = false) @Test(groups = {"UnitTest", "fast"}, timeOut = 5000, enabled = false)
public void PhaseTest1() { public void PhaseTest1() {
Phase phase = new Phase(); Phase phase = new Phase();
for (int i = 0; i < phase.phaseOrder.length; i++) { for (int i = 0; i < phase.phaseOrder.length; i++) {

View File

@@ -15,7 +15,7 @@ public class ReadQuestAssignmentTest implements NewConstants {
* *
* *
*/ */
@Test(timeOut = 1000) @Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
public void ReadQuestAssignmentTest1() { public void ReadQuestAssignmentTest1() {
try { try {
ReadQuest_Assignment read = new ReadQuest_Assignment(ForgeProps.getFile(QUEST.QUESTS), null); ReadQuest_Assignment read = new ReadQuest_Assignment(ForgeProps.getFile(QUEST.QUESTS), null);

View File

@@ -14,7 +14,7 @@ public class TinyTest {
/** /**
* Just a quick test to see if TestNG and Assert are working. * Just a quick test to see if TestNG and Assert are working.
*/ */
@Test() @Test(groups = {"UnitTest", "fast"})
public void test_true() { public void test_true() {
Assert.assertTrue(true); Assert.assertTrue(true);
} }

View File

@@ -21,7 +21,7 @@ import java.util.TreeSet;
* @author Forge * @author Forge
* @version $Id$ * @version $Id$
*/ */
@Test(groups = {"UnitTest"}) @Test(groups = {"UnitTest"}, timeOut = 5000)
public class CardFactoryTest implements NewConstants { public class CardFactoryTest implements NewConstants {
private static CardFactoryInterface factory; private static CardFactoryInterface factory;
@@ -35,7 +35,7 @@ public class CardFactoryTest implements NewConstants {
* Just a quick test to see if Arc-Slogger is in the database, and if it * Just a quick test to see if Arc-Slogger is in the database, and if it
* has the correct owner. * has the correct owner.
*/ */
@Test(enabled = true) @Test(enabled = true, timeOut = 5000)
public final void test_getCard_1() { public final void test_getCard_1() {
final Card card = factory.getCard("Arc-Slogger", null); final Card card = factory.getCard("Arc-Slogger", null);
Assert.assertNotNull(card, "card is not null"); Assert.assertNotNull(card, "card is not null");
@@ -47,7 +47,7 @@ public class CardFactoryTest implements NewConstants {
* *
* This doesn't work with LazyCardFactory, so it is too slow to enable by default. * This doesn't work with LazyCardFactory, so it is too slow to enable by default.
*/ */
@Test(enabled = false) @Test(enabled = false, timeOut = 5000)
public final void test_getRandomCombinationWithoutRepetition_tooLarge() { public final void test_getRandomCombinationWithoutRepetition_tooLarge() {
BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class, BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class,
new ClumsyRunnable() { new ClumsyRunnable() {
@@ -70,7 +70,7 @@ public class CardFactoryTest implements NewConstants {
* *
* This doesn't work with LazyCardFactory, so it is too slow to enable by default. * This doesn't work with LazyCardFactory, so it is too slow to enable by default.
*/ */
@Test(enabled = false) @Test(enabled = false, timeOut = 5000)
public final void test_getRandomCombinationWithoutRepetition_oneTenth() { public final void test_getRandomCombinationWithoutRepetition_oneTenth() {
int divisor = 10; int divisor = 10;
final CardList actual = factory.getRandomCombinationWithoutRepetition(factory.size() / divisor); final CardList actual = factory.getRandomCombinationWithoutRepetition(factory.size() / divisor);

View File

@@ -15,7 +15,7 @@ public class Mana_PartTest {
/** /**
* <p>testPayManaCost.</p> * <p>testPayManaCost.</p>
*/ */
@Test @Test(groups = {"UnitTest", "fast"}, timeOut = 5000)
public void testPayManaCost() { public void testPayManaCost() {
{ {
//test constructor //test constructor

View File

@@ -12,7 +12,7 @@ public class ListChooserTest {
* *
* *
*/ */
@Test(timeOut = 1000) @Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
public void ListChooserTest1() { public void ListChooserTest1() {
ListChooser<String> c = new ListChooser<String>("test", "choose a or b", 0, 2, "a", "b"); ListChooser<String> c = new ListChooser<String>("test", "choose a or b", 0, 2, "a", "b");
System.out.println(c.show()); System.out.println(c.show());

View File

@@ -3,8 +3,6 @@ package forge.gui.game;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import javax.swing.*;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: dhudson * User: dhudson
@@ -15,7 +13,7 @@ public class CardDetailPanelTest {
* *
* *
*/ */
@Test() @Test(groups = {"UnitTest", "fast"})
public void cardDetailPanelTest1() { public void cardDetailPanelTest1() {
try { try {
CardDetailPanel dialog = new CardDetailPanel(null); CardDetailPanel dialog = new CardDetailPanel(null);