@Test public void shouldCalculateTextRangeWithEndOffsetFromParametersListWhenTheyArePresent() { given(functionDeclaration.getTextRange()).willReturn(functionDeclarationTextRange); given(functionDeclaration.getParamList()).willReturn(functionDeclarationParamList); given(functionDeclarationParamList.getTextRange()) .willReturn(functionDeclarationParamListTextRange); TextRange result = textRangeCalculator.calculateTextRange(functionDeclaration); assertThat(result.getStartOffset(), is(FUNCTION_DECLARATION_START_OFFSET)); assertThat(result.getEndOffset(), is(FUNCTION_DECLARATION_PARAM_LIST_END_OFFSET)); }
@Test public void shouldCalculateTextRangeBasedOnTextRangeFromFunctionDeclaration() { given(functionDeclaration.getTextRange()).willReturn(functionDeclarationTextRange); TextRange result = textRangeCalculator.calculateTextRange(functionDeclaration); assertThat(result.getStartOffset(), is(FUNCTION_DECLARATION_START_OFFSET)); assertThat(result.getEndOffset(), is(FUNCTION_DECLARATION_END_OFFSET)); }