FileAnnotateDelegator extends BaseDelegator implements IFileAnnotateDelegator { @Override public List<IFileAnnotation> getFileAnnotations( final List<IFileSpec> fileSpecs, @Nonnull final DiffType diffType, final boolean allResults, final boolean useChangeNumbers, final boolean followBranches) throws ConnectionException, RequestException, AccessException { throwRequestExceptionIfConditionFails( isNull(diffType) || diffType.isWsOption(), "Bad whitespace option in getFileAnnotations"); try { GetFileAnnotationsOptions getFileAnnotationsOptions = new GetFileAnnotationsOptions() .setAllResults(allResults) .setUseChangeNumbers(useChangeNumbers) .setFollowBranches(followBranches) .setWsOpts(diffType); return getFileAnnotations(fileSpecs, getFileAnnotationsOptions); } catch (final ConnectionException | AccessException | RequestException exc) { throw exc; } catch (P4JavaException exc) { throw new RequestException(exc.getMessage(), exc); } } FileAnnotateDelegator(IOptionsServer server); @Override List<IFileAnnotation> getFileAnnotations(
            final List<IFileSpec> fileSpecs,
            @Nonnull final DiffType diffType,
            final boolean allResults,
            final boolean useChangeNumbers,
            final boolean followBranches); @Override List<IFileAnnotation> getFileAnnotations(
            final List<IFileSpec> fileSpecs,
            final GetFileAnnotationsOptions opts);  }
@Test public void shouldReturnNonEmptyFileAnnotationsWhenExistDepotFileGiven() throws Exception { mockResultMaps(); when(server.execMapCmdList(eq(ANNOTATE.toString()), any(String[].class), eq((Map<String, Object>) null))).thenReturn(resultMaps); List<IFileAnnotation> fileAnnotations = fileAnnotateDelegator.getFileAnnotations(fileSpecs, fileAnnotationsOptions); assertThat(fileAnnotations.size(), is(2)); }