java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
SameTest
public class SameTest
The test class SameTest. Here, uning JUnit, I have tested the model in great detail, though the view hasn't been tested in as much detail. I have not tested the controller at all. This is becuase the model, which holds data is easier to test via automated methods, while the view and especially the controller, are harder to test using these automated tests. They are best tested, visually, by seeing that the results match the expected outcomes.
Constructor Summary | |
---|---|
SameTest()
|
Method Summary | |
---|---|
protected void |
setUp()
Sets up the test fixture, which is called before every test case method, and as such, all the tests below also test the constructor of SameModel, as if it 'set up' the model wrong, the tests should fail or result in a runtime error. |
protected void |
tearDown()
Tears down the test fixture. |
void |
testBoxes()
Tests the getBoxes() method as well as testing that the boxes variable has the correct value |
void |
testGameOver_Shuffle()
Tests the isGameOver(), findNearbyMatches(), shuffleBoxesDown() & shuffleBoxesToRight() methods |
void |
testGetBox()
Tests the calculation of column and row index positions from single number index position, by comparing the values returned by the getBox() method with the expected value, which should be the same value as that of model.getBox(0) for all of them, but one |
void |
testHighlight()
Tests methods getBox(), getHighlight(), setHighlight(), changeSameHover(), changeSameHovered() & reColourHighlights() |
void |
testJSpinnerGetValues()
Tests the JSpinner's getValue() methods |
void |
testMatcheBoxesArrayList_Hint()
Tests the matchedBoxes array list, and thus the findNearbyMatches() method, as this produces the matchedBoxes array list |
void |
testScore()
Tests the findNearbyMatches() (called in setUp), getHoverScore(), getScore(), resetHoverScore(), setHoverScore() & updateScore() methods |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SameTest()
Method Detail |
---|
protected void setUp()
setUp
in class junit.framework.TestCase
protected void tearDown()
tearDown
in class junit.framework.TestCase
public void testBoxes()
public void testGameOver_Shuffle()
public void testGetBox()
public void testHighlight()
public void testJSpinnerGetValues()
public void testMatcheBoxesArrayList_Hint()
public void testScore()