public class FactoryClassesTest
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.awt.Color |
bgColor
The background color of a NetPuzlObject
|
private java.util.Map<ObjID,NetPuzlObject> |
cache
A cache/symbol table of NetPuzlObjects and their associated object IDs
|
private java.awt.Color |
fgColor
The foreground color of a NetPuzlObject
|
private Image |
image
The image of a NetPuzlObject
|
private java.lang.String |
name
The name of a NetPuzlObject
|
private java.util.Random |
random
A random number generator to use for testing
|
private java.lang.String |
text
The text of a NetPuzlObject
|
private int |
x
The x value of a NetPuzlObject
|
private int |
y
The y value of a NetPuzlObject
|
Constructor and Description |
---|
FactoryClassesTest() |
Modifier and Type | Method and Description |
---|---|
private java.awt.Color |
getRandomColor()
Gets a Color with a random red, green, blue, and alpha
|
private java.lang.String |
getRandomString(int length)
Gets an alphanumeric String of the specified length
|
void |
init()
Initializes a random number generator and a random set of Attributes
before each JUnit test
|
void |
testAgentFactory()
Tests that an agent factory produces an Agent with the expected
attributes, and tests that it properly adds the Agent to the cache
|
void |
testKeyFactory()
Tests that a key factory produces a Key with the expected attributes, and
tests that it properly adds the Key to the cache
|
void |
testMatrixFactory()
Tests that a matrix factory produces all types of Matrices with the
expected attributes, and tests that it properly adds the Matrices to the
cache
|
void |
testMultipleFactoriesCache()
Tests that multiple factories producing multiple NetPuzlObjects properly
adds the NetPuzlObjects to the cache
|
void |
testMultipleFactoriesObjIDs()
Tests that multiple factories producing multiple NetPuzlObjects properly
assign unique IDs to the NetPuzlObjects
|
void |
testTokenFactory()
Tests that a token factory produces a Token with the expected attributes,
and tests that it properly adds the Token to the cache
|
private java.util.Random random
private java.util.Map<ObjID,NetPuzlObject> cache
private java.lang.String name
private java.lang.String text
private java.awt.Color bgColor
private java.awt.Color fgColor
private int x
private int y
private Image image
private java.awt.Color getRandomColor()
private java.lang.String getRandomString(int length)
length
- The requested length of the Stringpublic void init()
public void testAgentFactory()
public void testKeyFactory()
public void testMatrixFactory()
public void testMultipleFactoriesCache()
public void testMultipleFactoriesObjIDs()
public void testTokenFactory()