Class SameTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by SameTest
All Implemented Interfaces:
junit.framework.Test

public class SameTest
extends junit.framework.TestCase

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.

Version:
1.0
Author:
Afzal Bhamjee

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

SameTest

public SameTest()
Method Detail

setUp

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.

Overrides:
setUp in class junit.framework.TestCase

tearDown

protected void tearDown()
Tears down the test fixture. Called after every test case method. Nothing to tear down

Overrides:
tearDown in class junit.framework.TestCase

testBoxes

public void testBoxes()
Tests the getBoxes() method as well as testing that the boxes variable has the correct value


testGameOver_Shuffle

public void testGameOver_Shuffle()
Tests the isGameOver(), findNearbyMatches(), shuffleBoxesDown() & shuffleBoxesToRight() methods


testGetBox

public 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


testHighlight

public void testHighlight()
Tests methods getBox(), getHighlight(), setHighlight(), changeSameHover(), changeSameHovered() & reColourHighlights()


testJSpinnerGetValues

public void testJSpinnerGetValues()
Tests the JSpinner's getValue() methods


testMatcheBoxesArrayList_Hint

public void testMatcheBoxesArrayList_Hint()
Tests the matchedBoxes array list, and thus the findNearbyMatches() method, as this produces the matchedBoxes array list


testScore

public void testScore()
Tests the findNearbyMatches() (called in setUp), getHoverScore(), getScore(), resetHoverScore(), setHoverScore() & updateScore() methods