@Test public void itIsIllegalToMoveToSetup_becauseKeywordsDontHaveSetups() { final UserKeyword keyword = new UserKeyword(RobotToken.create("keyword")); final KeywordOfUserContext context = new KeywordOfUserContext(keyword, URI.create("file: newArrayList()); assertThatExceptionOfType(IllegalDebugContextStateException.class) .isThrownBy(() -> context.moveTo(new RunningKeyword("lib", "kw", KeywordCallType.SETUP), mock(RobotBreakpointSupplier.class))) .withMessage("Setup or Teardown keyword cannot be called when user keyword is about to start") .withNoCause(); }
@Override public StackFrameContext moveTo(final RunningKeyword runningKeyword, final RobotBreakpointSupplier breakpointSupplier) { if (runningKeyword.isSetup() || runningKeyword.isTeardown()) { throw new IllegalDebugContextStateException( "Setup or Teardown keyword cannot be called when user keyword is about to start"); } else { final List<? extends RobotExecutableRow<?>> rows = keyword.getExecutionContext(); final List<ExecutableWithDescriptor> elements = ExecutablesCompiler.compileExecutables(rows, null); if (elements.isEmpty()) { final int line = keyword.getDeclaration().getLineNumber(); final String errorMsg = String.format(ErrorMessages.executableCallNotFound, runningKeyword.asCall()); return new ErroneousExecutableCallContext(locationUri, line, errorMsg); } else { return CommonContextsTransitions.moveToExecutable(models, locationUri, elements, 0, runningKeyword, breakpointSupplier); } } }
KeywordOfUserContext extends KeywordContext { @Override public StackFrameContext moveTo(final RunningKeyword runningKeyword, final RobotBreakpointSupplier breakpointSupplier) { if (runningKeyword.isSetup() || runningKeyword.isTeardown()) { throw new IllegalDebugContextStateException( "Setup or Teardown keyword cannot be called when user keyword is about to start"); } else { final List<? extends RobotExecutableRow<?>> rows = keyword.getExecutionContext(); final List<ExecutableWithDescriptor> elements = ExecutablesCompiler.compileExecutables(rows, null); if (elements.isEmpty()) { final int line = keyword.getDeclaration().getLineNumber(); final String errorMsg = String.format(ErrorMessages.executableCallNotFound, runningKeyword.asCall()); return new ErroneousExecutableCallContext(locationUri, line, errorMsg); } else { return CommonContextsTransitions.moveToExecutable(models, locationUri, elements, 0, runningKeyword, breakpointSupplier); } } } }
KeywordOfUserContext extends KeywordContext { @Override public StackFrameContext moveTo(final RunningKeyword runningKeyword, final RobotBreakpointSupplier breakpointSupplier) { if (runningKeyword.isSetup() || runningKeyword.isTeardown()) { throw new IllegalDebugContextStateException( "Setup or Teardown keyword cannot be called when user keyword is about to start"); } else { final List<? extends RobotExecutableRow<?>> rows = keyword.getExecutionContext(); final List<ExecutableWithDescriptor> elements = ExecutablesCompiler.compileExecutables(rows, null); if (elements.isEmpty()) { final int line = keyword.getDeclaration().getLineNumber(); final String errorMsg = String.format(ErrorMessages.executableCallNotFound, runningKeyword.asCall()); return new ErroneousExecutableCallContext(locationUri, line, errorMsg); } else { return CommonContextsTransitions.moveToExecutable(models, locationUri, elements, 0, runningKeyword, breakpointSupplier); } } } KeywordOfUserContext(final UserKeyword keyword, final URI locationUri, final List<RobotFile> models); }
KeywordOfUserContext extends KeywordContext { @Override public StackFrameContext moveTo(final RunningKeyword runningKeyword, final RobotBreakpointSupplier breakpointSupplier) { if (runningKeyword.isSetup() || runningKeyword.isTeardown()) { throw new IllegalDebugContextStateException( "Setup or Teardown keyword cannot be called when user keyword is about to start"); } else { final List<? extends RobotExecutableRow<?>> rows = keyword.getExecutionContext(); final List<ExecutableWithDescriptor> elements = ExecutablesCompiler.compileExecutables(rows, null); if (elements.isEmpty()) { final int line = keyword.getDeclaration().getLineNumber(); final String errorMsg = String.format(ErrorMessages.executableCallNotFound, runningKeyword.asCall()); return new ErroneousExecutableCallContext(locationUri, line, errorMsg); } else { return CommonContextsTransitions.moveToExecutable(models, locationUri, elements, 0, runningKeyword, breakpointSupplier); } } } KeywordOfUserContext(final UserKeyword keyword, final URI locationUri, final List<RobotFile> models); @Override Optional<URI> getAssociatedPath(); @Override Optional<FileRegion> getFileRegion(); @Override StackFrameContext moveTo(final RunningKeyword runningKeyword,
            final RobotBreakpointSupplier breakpointSupplier); }
KeywordOfUserContext extends KeywordContext { @Override public StackFrameContext moveTo(final RunningKeyword runningKeyword, final RobotBreakpointSupplier breakpointSupplier) { if (runningKeyword.isSetup() || runningKeyword.isTeardown()) { throw new IllegalDebugContextStateException( "Setup or Teardown keyword cannot be called when user keyword is about to start"); } else { final List<? extends RobotExecutableRow<?>> rows = keyword.getExecutionContext(); final List<ExecutableWithDescriptor> elements = ExecutablesCompiler.compileExecutables(rows, null); if (elements.isEmpty()) { final int line = keyword.getDeclaration().getLineNumber(); final String errorMsg = String.format(ErrorMessages.executableCallNotFound, runningKeyword.asCall()); return new ErroneousExecutableCallContext(locationUri, line, errorMsg); } else { return CommonContextsTransitions.moveToExecutable(models, locationUri, elements, 0, runningKeyword, breakpointSupplier); } } } KeywordOfUserContext(final UserKeyword keyword, final URI locationUri, final List<RobotFile> models); @Override Optional<URI> getAssociatedPath(); @Override Optional<FileRegion> getFileRegion(); @Override StackFrameContext moveTo(final RunningKeyword runningKeyword,
            final RobotBreakpointSupplier breakpointSupplier);  }