ExecutableWithDescriptor { int getLine() { return getDescriptor().getRow().getDeclaration().getLineNumber(); } ExecutableWithDescriptor(final RobotExecutableRow<?> executable, final IExecutableRowDescriptor<?> descriptor,
            final String template);   ExecutableWithDescriptor(final ForLoop loopExecutable, final String template);   }
@Test public void lineOfKeywordCallIsTakenFromExecutable_1() { final RobotToken token = RobotToken.create("keyword"); token.setFilePosition(new FilePosition(42, 0, 100)); final RobotExecutableRow<UserKeyword> executable = new RobotExecutableRow<>(); executable.setAction(token); final IExecutableRowDescriptor descriptor = mock(IExecutableRowDescriptor.class); when(descriptor.getRow()).thenReturn(executable); final ExecutableWithDescriptor execDescriptor = new ExecutableWithDescriptor(executable, descriptor, null); assertThat(execDescriptor.getLine()).isEqualTo(42); }
@Test public void lineOfKeywordCallIsTakenFromExecutable_2() { final RobotToken token = RobotToken.create("keyword_in_loop"); token.setFilePosition(new FilePosition(57, 0, 100)); final RobotExecutableRow<UserKeyword> executable = new RobotExecutableRow<>(); executable.setAction(token); final ForLoopContinueRowDescriptor<?> descriptor = new ForLoopContinueRowDescriptor<>(executable); final ExecutableWithDescriptor execDescriptor = new ExecutableWithDescriptor(executable, descriptor, null); assertThat(execDescriptor.getLine()).isEqualTo(57); }