@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); }
@Test public void shouldCreateErrorAnnotationWhenDuplicateFoundInImportedFile() { given(determiner.getImportedFileWithDuplicatedDeclaration(functionName, file)) .willReturn(importedFile); creator.createDuplicateFunctionDeclarationError(holder, functionName, file); verify(annotationHolderModifier).modifyHolder(holder, functionName, importedFile); verifyNoMoreInteractions(annotationHolderModifier); }
@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); }