Package h07.graph
Class AdjacencyMatrixFactoryTest
- java.lang.Object
-
- h07.util.TestClass
-
- h07.graph.AdjacencyMatrixFactoryTest
-
public class AdjacencyMatrixFactoryTest extends TestClass
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class h07.util.TestClass
TestClass.MissingMemberException
-
-
Field Summary
Fields Modifier and Type Field Description Field
adjacencyMatrix
Field
object forAdjacencyMatrixFactory.adjacencyMatrix
Method
createDirectedGraph
Method
object forDirectedGraphFactory.createDirectedGraph()
private TemplateTests.DirectedGraphFactoryTemplateTest
directedGraphFactory
Instance ofTemplateTests.DirectedGraphFactoryTemplateTest
Field
nodes
Field
object forAdjacencyMatrixFactory.nodes
-
Fields inherited from class h07.util.TestClass
classDescriptor, className, constructor, fields, methods, RANDOM
-
-
Constructor Summary
Constructors Constructor Description AdjacencyMatrixFactoryTest()
Creates a newAdjacencyMatrixFactoryTest
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
testCreateDirectedGraph()
Tests forAdjacencyMatrixFactory.createDirectedGraph()
.void
testDefinition()
Tests the definition ofAdjacencyMatrixFactory
.void
testInstance()
Tests an instance ofAdjacencyMatrixFactory
.-
Methods inherited from class h07.util.TestClass
getClassForName, getFieldByCriteria, getFieldByName, getMethodByCriteria, getMethodByName, getMethodSignature, invokeExpectingException, newInstance, newInstanceExpectingException
-
-
-
-
Field Detail
-
nodes
public final Field nodes
Field
object forAdjacencyMatrixFactory.nodes
-
adjacencyMatrix
public final Field adjacencyMatrix
Field
object forAdjacencyMatrixFactory.adjacencyMatrix
-
createDirectedGraph
public final Method createDirectedGraph
Method
object forDirectedGraphFactory.createDirectedGraph()
-
directedGraphFactory
private final TemplateTests.DirectedGraphFactoryTemplateTest directedGraphFactory
Instance ofTemplateTests.DirectedGraphFactoryTemplateTest
-
-
Constructor Detail
-
AdjacencyMatrixFactoryTest
public AdjacencyMatrixFactoryTest()
Creates a newAdjacencyMatrixFactoryTest
object. Requires thatAdjacencyMatrixFactory
exists and has a constructor with two parameters: the first one with typeV[]
and the second one with typeA[][]
. Also requires that the class has two fields,nodes
andadjacencyMatrix
.
-
-
Method Detail
-
testDefinition
@Test public void testDefinition()
Tests the definition ofAdjacencyMatrixFactory
.- Asserts that the class...
- is public
- is not abstract
- is generic and has the type parameters V and A
- implements
DirectedGraphFactory
- Asserts that the constructor is public
- Asserts that the field
nodes
...- is private and final
- is not static
- has type
V[]
- Asserts that the field
adjacencyMatrix
...- is private and final
- is not static
- has type
A[][]
- Specified by:
testDefinition
in classTestClass
- Asserts that the class...
-
testInstance
@Test public void testInstance() throws ReflectiveOperationException
Tests an instance ofAdjacencyMatrixFactory
.
Asserts that the fieldsnodes
andadjacencyMatrix
are initialized correctly. Also asserts that aNullPointerException
is thrown when the constructor is invoked withnull
and that aIllegalArgumentException
is thrown when parameters are malformed (criteria "length of array == number of rows == number of columns
" is not fulfilled).- Overrides:
testInstance
in classTestClass
- Throws:
ReflectiveOperationException
- if any invocation fails
-
testCreateDirectedGraph
@Test public void testCreateDirectedGraph() throws ReflectiveOperationException
Tests forAdjacencyMatrixFactory.createDirectedGraph()
.
Asserts that the object returned by the tested method is actually an instance ofDirectedGraphImpl
.- Throws:
ReflectiveOperationException
- if any invocation fails
-
-