Package h07.graph
Class PathImplTest.TraverserTest
- java.lang.Object
-
- h07.graph.PathImplTest.TraverserTest
-
- Enclosing class:
- PathImplTest
@Nested public class PathImplTest.TraverserTest extends Object
-
-
Field Summary
Fields Modifier and Type Field Description Method
getCurrentNode
Method
object forPath.Traverser.getCurrentNode()
Method
getDistanceToNextNode
Method
object forPath.Traverser.getDistanceToNextNode()
Method
hasNextNode
Method
object forPath.Traverser.hasNextNode()
Method
walkToNextNode
Method
object forPath.Traverser.walkToNextNode()
-
Constructor Summary
Constructors Constructor Description TraverserTest()
Creates a newPathImplTest.TraverserTest
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
testGetCurrentNode(Character[] nodes, int[] arcWeights)
Tests forPath.Traverser.getCurrentNode()
on theTraverser
returned byPathImpl.traverser()
.void
testGetDistanceToNextNode(Character[] nodes, int[] arcWeights)
Tests forPath.Traverser.getDistanceToNextNode()
on theTraverser
returned byPathImpl.traverser()
.void
testHasNextNode(Character[] nodes, int[] arcWeights)
Tests forPath.Traverser.hasNextNode()
on theTraverser
returned byPathImpl.traverser()
.void
testWalkToNextNode(Character[] nodes, int[] arcWeights)
Tests forPath.Traverser.walkToNextNode()
on theTraverser
returned byPathImpl.traverser()
.
-
-
-
Field Detail
-
getCurrentNode
public final Method getCurrentNode
Method
object forPath.Traverser.getCurrentNode()
-
getDistanceToNextNode
public final Method getDistanceToNextNode
Method
object forPath.Traverser.getDistanceToNextNode()
-
walkToNextNode
public final Method walkToNextNode
Method
object forPath.Traverser.walkToNextNode()
-
hasNextNode
public final Method hasNextNode
Method
object forPath.Traverser.hasNextNode()
-
-
Constructor Detail
-
TraverserTest
public TraverserTest()
Creates a newPathImplTest.TraverserTest
object.
-
-
Method Detail
-
testGetCurrentNode
@ParameterizedTest @ArgumentsSource(PathProvider.class) public void testGetCurrentNode(Character[] nodes, int[] arcWeights) throws ReflectiveOperationException
Tests forPath.Traverser.getCurrentNode()
on theTraverser
returned byPathImpl.traverser()
.
Asserts that the tested method returns the same node thePath
was instantiated with when invoked multiple times.- Parameters:
nodes
- an array of nodes (supplied by the arguments provider)arcWeights
- an array of weights from a node at indexi
to the one at indexi + 1
(unused, supplied by the arguments provider)- Throws:
ReflectiveOperationException
- if any invocation fails
-
testGetDistanceToNextNode
@ParameterizedTest @ArgumentsSource(PathProvider.class) public void testGetDistanceToNextNode(Character[] nodes, int[] arcWeights) throws ReflectiveOperationException
Tests forPath.Traverser.getDistanceToNextNode()
on theTraverser
returned byPathImpl.traverser()
.
Asserts that the tested method returns the expected value when invoked and the current node is not the last one in this path. If it is, asserts that anIllegalArgumentException
is thrown.- Parameters:
nodes
- an array of nodes (supplied by the arguments provider)arcWeights
- an array of weights from a node at indexi
to the one at indexi + 1
(supplied by the arguments provider)- Throws:
ReflectiveOperationException
- if any invocation fails
-
testWalkToNextNode
@ParameterizedTest @ArgumentsSource(PathProvider.class) public void testWalkToNextNode(Character[] nodes, int[] arcWeights) throws ReflectiveOperationException
Tests forPath.Traverser.walkToNextNode()
on theTraverser
returned byPathImpl.traverser()
. RequirestestGetCurrentNode(Character[], int[])
.
Asserts that the tested method advances the traverser to the next node when invoked and the current node is not the last one in this path. If it is, asserts that anNoSuchElementException
is thrown.- Parameters:
nodes
- an array of nodes (supplied by the arguments provider)arcWeights
- an array of weights from a node at indexi
to the one at indexi + 1
(supplied by the arguments provider)- Throws:
ReflectiveOperationException
- if any invocation fails
-
testHasNextNode
@ParameterizedTest @ArgumentsSource(PathProvider.class) public void testHasNextNode(Character[] nodes, int[] arcWeights) throws ReflectiveOperationException
Tests forPath.Traverser.hasNextNode()
on theTraverser
returned byPathImpl.traverser()
.
Asserts that the tested method returnstrue
if the current node is not the last one in this path. If it is, asserts thatfalse
is returned.- Parameters:
nodes
- an array of nodes (supplied by the arguments provider)arcWeights
- an array of weights from a node at indexi
to the one at indexi + 1
(supplied by the arguments provider)- Throws:
ReflectiveOperationException
- if any invocation fails
-
-