def test_whenHandlingSaidStateThenPathfinderIsNotCalled(self):
        testedState = SequencerState.StopMovingState()

        testedState.handle(self.sequencer, self.map, self.pathfinder)

        assert not self.pathfinder.findPath.called
        assert not self.sequencer.setState.called
    def test_whenHandlingSaidStateThenPathfinderIsCalled(self):
        testedState = SequencerState.SendingBotToTreasureState()

        testedState.handle(self.sequencer,self.map, self.pathfinder)

        assert self.pathfinder.findPath.called
        assert self.sequencer.setState.called
    def test_whenHandlingSaidStateThenReturnsCorrectNextSignalInSequence(self):
        testedState = SequencerState.DetectTreasureState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual("detectTreasure", signal)
    def test_whenHandlingSaidStateThenReturnsNoneAsOrientation(self):
        testedState = SequencerState.StopMovingState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual(None, orientation)
    def test_whenHandlingSaidStateThenReturnsCorrectNextSignalInSequence(self):
        testedState = SequencerState.SendingBotToTargetState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual("alignPositionToTarget", signal)
    def test_whenHandlingSaidStateThenReturnsCorrectOrientationToGiveRobot(
            self):
        testedState = SequencerState.DetectTreasureState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual(180, orientation)
    def test_whenHandlingSaidStateThenReturnsCorrectOrientationToGiveRobot(
            self):
        testedState = SequencerState.SendingBotToTargetState()

        path, signal, orientation = testedState.handle(self.sequencer,
                                                       self.map,
                                                       self.pathfinder)

        self.assertEqual(90, orientation)