Package h07.experiment
Class ChickenNuggetGraphFactoryTest.ChickenNuggetGraphTest
- java.lang.Object
-
- h07.experiment.ChickenNuggetGraphFactoryTest.ChickenNuggetGraphTest
-
- Enclosing class:
- ChickenNuggetGraphFactoryTest
@Nested public class ChickenNuggetGraphFactoryTest.ChickenNuggetGraphTest extends Object
Tests for theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
Depends onTemplateTests.DirectedGraphTemplateTest
.
-
-
Field Summary
Fields Modifier and Type Field Description Method
addNode
Method
object forh07.graph.DirectedGraph.addNode(V)
Method
connectNodes
Method
object forh07.graph.DirectedGraph.connectNodes(V, A, V)
Method
disconnectNodes
Method
object forh07.graph.DirectedGraph.disconnectNodes(V, V)
Method
getAllNodes
Method
object forh07.graph.DirectedGraph.getAllNodes()
Method
getArcWeightBetween
Method
object forh07.graph.DirectedGraph.getArcWeightBetween(V, V)
Method
getChildrenForNode
Method
object forh07.graph.DirectedGraph.getChildrenForNode(V)
private Collection<Integer>
nodes
Collection
of expected nodesMethod
removeNode
Method
object forh07.graph.DirectedGraph.removeNode(V)
-
Constructor Summary
Constructors Constructor Description ChickenNuggetGraphTest()
Creates a newChickenNuggetGraphFactoryTest.ChickenNuggetGraphTest
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
newInstance()
Returns a newDirectedGraph
object.void
testAddNode()
Tests foraddNode(Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.void
testConnectNodes()
Tests forconnectNodes(Integer, Integer, Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.void
testDisconnectNodes()
Tests fordisconnectNodes(Integer, Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.void
testGetAllNodes()
Tests forgetAllNodes()
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.void
testGetArcWeightBetween()
Tests forgetArcWeightBetween(Integer, Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.void
testGetChildrenForNode()
Tests forgetChildrenForNode(Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.void
testRemoveNode()
Tests forremoveNode(Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
-
-
-
Field Detail
-
getAllNodes
public final Method getAllNodes
Method
object forh07.graph.DirectedGraph.getAllNodes()
-
getChildrenForNode
public final Method getChildrenForNode
Method
object forh07.graph.DirectedGraph.getChildrenForNode(V)
-
getArcWeightBetween
public final Method getArcWeightBetween
Method
object forh07.graph.DirectedGraph.getArcWeightBetween(V, V)
-
addNode
public final Method addNode
Method
object forh07.graph.DirectedGraph.addNode(V)
-
removeNode
public final Method removeNode
Method
object forh07.graph.DirectedGraph.removeNode(V)
-
connectNodes
public final Method connectNodes
Method
object forh07.graph.DirectedGraph.connectNodes(V, A, V)
-
disconnectNodes
public final Method disconnectNodes
Method
object forh07.graph.DirectedGraph.disconnectNodes(V, V)
-
nodes
private final Collection<Integer> nodes
Collection
of expected nodes
-
-
Constructor Detail
-
ChickenNuggetGraphTest
public ChickenNuggetGraphTest()
Creates a newChickenNuggetGraphFactoryTest.ChickenNuggetGraphTest
object.
-
-
Method Detail
-
testGetAllNodes
@Test public void testGetAllNodes() throws ReflectiveOperationException
Tests forgetAllNodes()
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
Asserts that the collection returned by the tested method is immutable and has the same size and elements asnodes
.- Throws:
ReflectiveOperationException
- if any invocation fails
-
testGetChildrenForNode
@Test public void testGetChildrenForNode() throws ReflectiveOperationException
Tests forgetChildrenForNode(Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
Asserts that the collection returned by the tested method is immutable. Further asserts that the collection has the same size and elements as the expected set of children for a given node. Also asserts that the method throws aNullPointerException
if invoked withnull
and aNoSuchElementException
if invoked with a node that is not in this graph.- Throws:
ReflectiveOperationException
- if any invocation fails
-
testGetArcWeightBetween
@Test public void testGetArcWeightBetween() throws ReflectiveOperationException
Tests forgetArcWeightBetween(Integer, Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
Asserts that the values returned by the tested method for given pairs of nodes equals the expected ones. Also asserts that the method throws aNullPointerException
if invoked withnull
and aNoSuchElementException
if invoked with a node that is not in this graph.- Throws:
ReflectiveOperationException
- if any invocation fails
-
testAddNode
@Test public void testAddNode()
Tests foraddNode(Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
Asserts that aUnsupportedOperationException
is thrown whenever invoked, regardless of parameters.
-
testRemoveNode
@Test public void testRemoveNode()
Tests forremoveNode(Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
Asserts that aUnsupportedOperationException
is thrown whenever invoked, regardless of parameters.
-
testConnectNodes
@Test public void testConnectNodes()
Tests forconnectNodes(Integer, Integer, Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
Asserts that aUnsupportedOperationException
is thrown whenever invoked, regardless of parameters.
-
testDisconnectNodes
@Test public void testDisconnectNodes()
Tests fordisconnectNodes(Integer, Integer)
on theDirectedGraph
returned byChickenNuggetGraphFactory.createDirectedGraph()
.
Asserts that aUnsupportedOperationException
is thrown whenever invoked, regardless of parameters.
-
newInstance
public Object newInstance()
Returns a newDirectedGraph
object. This method invokesChickenNuggetGraphFactory.createDirectedGraph()
and returns the result.- Returns:
- the
DirectedGraph
instance
-
-