コード例 #1
0
  @Test
  public void shouldDoNothingWhenNoDuplicateFound() {
    given(determiner.hasDuplicateDeclarationInTheSameFile(functionName, file)).willReturn(false);
    given(determiner.getImportedFileWithDuplicatedDeclaration(functionName, file)).willReturn(null);

    creator.createDuplicateFunctionDeclarationError(holder, functionName, file);

    verifyZeroInteractions(annotationHolderModifier);
  }
コード例 #2
0
  @Test
  public void shouldCreateErrorAnnotationWhenDuplicateFoundInTheSameFile() {
    given(determiner.hasDuplicateDeclarationInTheSameFile(functionName, file)).willReturn(true);

    creator.createDuplicateFunctionDeclarationError(holder, functionName, file);

    verify(annotationHolderModifier).modifyHolder(holder, functionName, file);
    verifyNoMoreInteractions(annotationHolderModifier);
  }
コード例 #3
0
  @Test
  public void shouldCreateErrorAnnotationTwice() {
    given(determiner.hasDuplicateDeclarationInTheSameFile(functionName, file)).willReturn(true);
    given(determiner.getImportedFileWithDuplicatedDeclaration(functionName, file))
        .willReturn(importedFile);

    creator.createDuplicateFunctionDeclarationError(holder, functionName, file);

    verify(annotationHolderModifier).modifyHolder(holder, functionName, file);
    verify(annotationHolderModifier).modifyHolder(holder, functionName, importedFile);
  }