Package h07.graph

Class PathImplTest.TraverserTest

    • Field Detail

      • getCurrentNode

        public final Method getCurrentNode
        Method object for Path.Traverser.getCurrentNode()
      • getDistanceToNextNode

        public final Method getDistanceToNextNode
        Method object for Path.Traverser.getDistanceToNextNode()
      • walkToNextNode

        public final Method walkToNextNode
        Method object for Path.Traverser.walkToNextNode()
      • hasNextNode

        public final Method hasNextNode
        Method object for Path.Traverser.hasNextNode()
    • Method Detail

      • testGetCurrentNode

        @ParameterizedTest
        @ArgumentsSource(PathProvider.class)
        public void testGetCurrentNode​(Character[] nodes,
                                       int[] arcWeights)
                                throws ReflectiveOperationException
        Tests for Path.Traverser.getCurrentNode() on the Traverser returned by PathImpl.traverser().
        Asserts that the tested method returns the same node the Path 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 index i to the one at index i + 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 for Path.Traverser.getDistanceToNextNode() on the Traverser returned by PathImpl.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 an IllegalArgumentException is thrown.
        Parameters:
        nodes - an array of nodes (supplied by the arguments provider)
        arcWeights - an array of weights from a node at index i to the one at index i + 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 for Path.Traverser.hasNextNode() on the Traverser returned by PathImpl.traverser().
        Asserts that the tested method returns true if the current node is not the last one in this path. If it is, asserts that false is returned.
        Parameters:
        nodes - an array of nodes (supplied by the arguments provider)
        arcWeights - an array of weights from a node at index i to the one at index i + 1 (supplied by the arguments provider)
        Throws:
        ReflectiveOperationException - if any invocation fails