SetupTeardownContext extends DefaultContext { @Override public StackFrameContext moveTo(final RunningKeyword keyword, final RobotBreakpointSupplier breakpointSupplier) { throw new IllegalDebugContextStateException( "Only single keyword can be called as setup or teardown, so it impossible to move to next one if already positioned at first one"); } SetupTeardownContext(final URI locationUri, final String keywordName, final int line,
            final StackFrameContext previousContext,
            final RobotBreakpointSupplier breakpointSupplier);   SetupTeardownContext(final String errorMessage, final StackFrameContext previousContext);   SetupTeardownContext(final URI locationUri, final int line, final String errorMessage,
            final StackFrameContext previousContext);   SetupTeardownContext(final URI locationUri, final int line, final String errorMessage,
            final StackFrameContext previousContext, final RobotBreakpointSupplier breakpointSupplier); private  SetupTeardownContext(final URI locationUri, final String keywordName, final int line,
            final String errorMessage, final StackFrameContext previousContext,
            final RobotBreakpointSupplier breakpointSupplier); @Override boolean isErroneous(); @Override Optional<String> getErrorMessage(); @Override Optional<URI> getAssociatedPath(); @Override Optional<FileRegion> getFileRegion(); @Override StackFrameContext moveTo(final RunningKeyword keyword, final RobotBreakpointSupplier breakpointSupplier); @Override StackFrameContext previousContext(); @Override Optional<RobotBreakpoint> getLineBreakpoint(); @Override Optional<RobotBreakpoint> getKeywordFailBreakpoint(final QualifiedKeywordName currentlyFailedKeyword);  }
@Test public void itIsIllegalTryingToMoveToAnthoerKeywordWhenInSetupOrTeardownContext() { final RobotBreakpointSupplier breakpointSupplier = mock(RobotBreakpointSupplier.class); final SetupTeardownContext context = new SetupTeardownContext(URI.create("file: mock(StackFrameContext.class), breakpointSupplier); for (final KeywordCallType type : EnumSet.allOf(KeywordCallType.class)) { assertThatExceptionOfType(IllegalDebugContextStateException.class) .isThrownBy(() -> context.moveTo(new RunningKeyword("_", "_", type), breakpointSupplier)) .withMessage( "Only single keyword can be called as setup or teardown, so it impossible to move to next one if already positioned at first one") .withNoCause(); } }