mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
update unit tests to make them less painful from command line. Fixed urls in Maven site home page
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -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/GuiQuestOptionsTest.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/PhaseTest.java svneol=native#text/plain
|
||||
src/test/java/forge/ReadBoosterPackTest.java svneol=native#text/plain
|
||||
|
||||
1
pom.xml
1
pom.xml
@@ -173,6 +173,7 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<groups>fast</groups>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Maven Project Site
|
||||
-----
|
||||
-----
|
||||
2011-06-30
|
||||
2011-08-10
|
||||
-----
|
||||
|
||||
Forge
|
||||
@@ -31,7 +31,7 @@ Forge
|
||||
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
|
||||
{{{http://code.google.com/p/cardforge/downloads/list}here}}.
|
||||
{{{http://cardforge.org/releases/releases/}here}}.
|
||||
|
||||
<<Maven Project Links>>
|
||||
|
||||
@@ -47,7 +47,7 @@ Forge
|
||||
* {{{http://cardforge.org/}Main Website}}
|
||||
|
||||
* {{{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}}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BoosterDraftAITest {
|
||||
}//for outer
|
||||
}//runTestPrint()
|
||||
|
||||
@Test
|
||||
@Test(timeOut = 5000)
|
||||
public void runTest(BoosterDraftAI ai) {
|
||||
ReadDraftBoosterPack booster = new ReadDraftBoosterPack();
|
||||
for (int outer = 0; outer < 1; outer++) {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class BoosterDraft_1Test {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Test(timeOut = 1000)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
|
||||
public void BoosterDraft_1Test1() throws Exception {
|
||||
BoosterDraft_1 draft = new BoosterDraft_1();
|
||||
while (draft.hasNextChoice()) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CardColorTest {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Test(timeOut = 1000)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
|
||||
public void CardColorTest1() {
|
||||
ManaCost mc = new ManaCost("R W U");
|
||||
EnumSet<Color> col = Color.ConvertManaCostToColor(mc);
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
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.IOException;
|
||||
import java.util.HashMap;
|
||||
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 org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
|
||||
@Test(timeOut = TEST_TIMEOUT)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
public final void test_ReadCard_nullMap() {
|
||||
final ClumsyRunnable withScissors = new ClumsyRunnable() {
|
||||
public void run() throws Exception {
|
||||
@@ -38,7 +37,7 @@ public class CardReaderTest implements NewConstants {
|
||||
assertThrowsException(NullPointerException.class, withScissors);
|
||||
}
|
||||
|
||||
@Test(timeOut = TEST_TIMEOUT)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
public final void test_ReadCard_nullCardsFolder() {
|
||||
final ClumsyRunnable withScissors = new ClumsyRunnable() {
|
||||
public void run() throws Exception {
|
||||
@@ -50,7 +49,7 @@ public class CardReaderTest implements NewConstants {
|
||||
assertThrowsException(NullPointerException.class, withScissors);
|
||||
}
|
||||
|
||||
@Test(timeOut = TEST_TIMEOUT)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
public final void test_ReadCard_nonexistentCardsFolder() {
|
||||
final ClumsyRunnable withScissors = new ClumsyRunnable() {
|
||||
public void run() throws Exception {
|
||||
@@ -64,7 +63,7 @@ public class CardReaderTest implements NewConstants {
|
||||
assertThrowsException(RuntimeException.class, withScissors);
|
||||
}
|
||||
|
||||
@Test(timeOut = TEST_TIMEOUT)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
public final void test_ReadCard_fileNotFolder() throws IOException {
|
||||
|
||||
final File tmpFile = File.createTempFile("just-a-file", ".testng.tmp");
|
||||
@@ -80,7 +79,7 @@ public class CardReaderTest implements NewConstants {
|
||||
assertThrowsException(RuntimeException.class, withScissors);
|
||||
}
|
||||
|
||||
@Test(timeOut = TEST_TIMEOUT)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = TEST_TIMEOUT)
|
||||
public final void test_ReadCard_findCard_zip() {
|
||||
final Map<String, Card> map = new HashMap<String, Card>();
|
||||
final File cardsfolder = ForgeProps.getFile(CARDSFOLDER);
|
||||
@@ -96,7 +95,7 @@ public class CardReaderTest implements NewConstants {
|
||||
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() {
|
||||
final Map<String, Card> map = new HashMap<String, Card>();
|
||||
final File cardsfolder = ForgeProps.getFile(CARDSFOLDER);
|
||||
|
||||
@@ -12,7 +12,7 @@ public class GameActionTest {
|
||||
/**
|
||||
* <p>main.</p>
|
||||
*/
|
||||
@Test(timeOut = 1000)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 5000)
|
||||
public void GameActionTest1() throws Exception {
|
||||
System.out.println("GameActionTest");
|
||||
GameAction gameAction = new GameAction();
|
||||
|
||||
@@ -16,7 +16,7 @@ public class GuiBoosterDraftTest {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test()
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void GuiBoosterDraftTest1() {
|
||||
Constant.Runtime.GameType[0] = Constant.GameType.Draft;
|
||||
Constant.Runtime.HumanDeck[0] = new Deck(Constant.GameType.Sealed);
|
||||
|
||||
@@ -3,8 +3,6 @@ package forge;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
@@ -15,11 +13,10 @@ public class GuiFilterTest {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test()
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void guiFilterTest1() {
|
||||
try {
|
||||
GuiFilter dialog = new GuiFilter(null, null);
|
||||
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
dialog.setVisible(true);
|
||||
Assert.assertNotNull(dialog);
|
||||
dialog.dispose();
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GuiProgressBarWindowTest {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test()
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void GuiProgressBarWindowTest1() {
|
||||
try {
|
||||
Gui_ProgressBarWindow dialog = new Gui_ProgressBarWindow();
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GuiQuestFilterTest {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test()
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void guiQuestFilterTest1() {
|
||||
try {
|
||||
GuiQuestFilter dialog = new GuiQuestFilter(null, null);
|
||||
|
||||
@@ -13,7 +13,7 @@ public class GuiQuestOptionsTest {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test()
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void GuiQuestOptionsTest1() {
|
||||
Gui_QuestOptions dialog = new Gui_QuestOptions();
|
||||
dialog.setVisible(true);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package forge;
|
||||
|
||||
import forge.deck.Deck;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -9,13 +7,13 @@ import org.testng.annotations.Test;
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
*/
|
||||
@Test(groups = {"UnitTest"})
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public class GuiWinLoseTest {
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test()
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void GuiWinLoseTest1() {
|
||||
Gui_WinLose dialog = new Gui_WinLose();
|
||||
dialog.setVisible(true);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public class PhaseTest {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test(timeOut = 5000, enabled = false)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 5000, enabled = false)
|
||||
public void PhaseTest1() {
|
||||
Phase phase = new Phase();
|
||||
for (int i = 0; i < phase.phaseOrder.length; i++) {
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ReadQuestAssignmentTest implements NewConstants {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test(timeOut = 1000)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
|
||||
public void ReadQuestAssignmentTest1() {
|
||||
try {
|
||||
ReadQuest_Assignment read = new ReadQuest_Assignment(ForgeProps.getFile(QUEST.QUESTS), null);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class TinyTest {
|
||||
/**
|
||||
* Just a quick test to see if TestNG and Assert are working.
|
||||
*/
|
||||
@Test()
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void test_true() {
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.TreeSet;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
@Test(groups = {"UnitTest"})
|
||||
@Test(groups = {"UnitTest"}, timeOut = 5000)
|
||||
public class CardFactoryTest implements NewConstants {
|
||||
|
||||
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
|
||||
* has the correct owner.
|
||||
*/
|
||||
@Test(enabled = true)
|
||||
@Test(enabled = true, timeOut = 5000)
|
||||
public final void test_getCard_1() {
|
||||
final Card card = factory.getCard("Arc-Slogger", 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.
|
||||
*/
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = false, timeOut = 5000)
|
||||
public final void test_getRandomCombinationWithoutRepetition_tooLarge() {
|
||||
BraidsAssertFunctions.assertThrowsException(IllegalArgumentException.class,
|
||||
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.
|
||||
*/
|
||||
@Test(enabled = false)
|
||||
@Test(enabled = false, timeOut = 5000)
|
||||
public final void test_getRandomCombinationWithoutRepetition_oneTenth() {
|
||||
int divisor = 10;
|
||||
final CardList actual = factory.getRandomCombinationWithoutRepetition(factory.size() / divisor);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Mana_PartTest {
|
||||
/**
|
||||
* <p>testPayManaCost.</p>
|
||||
*/
|
||||
@Test
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 5000)
|
||||
public void testPayManaCost() {
|
||||
{
|
||||
//test constructor
|
||||
|
||||
@@ -12,7 +12,7 @@ public class ListChooserTest {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test(timeOut = 1000)
|
||||
@Test(groups = {"UnitTest", "fast"}, timeOut = 1000)
|
||||
public void ListChooserTest1() {
|
||||
ListChooser<String> c = new ListChooser<String>("test", "choose a or b", 0, 2, "a", "b");
|
||||
System.out.println(c.show());
|
||||
|
||||
@@ -3,8 +3,6 @@ package forge.gui.game;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: dhudson
|
||||
@@ -15,7 +13,7 @@ public class CardDetailPanelTest {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test()
|
||||
@Test(groups = {"UnitTest", "fast"})
|
||||
public void cardDetailPanelTest1() {
|
||||
try {
|
||||
CardDetailPanel dialog = new CardDetailPanel(null);
|
||||
|
||||
Reference in New Issue
Block a user