TelemetryLogger { public void logResultsForProject(ImmutableList<Suggestion> suggestions) { uploadLogs(buildResultLog(suggestions, null).setArtifactType(ArtifactType.PROJECT_DIR)); } @VisibleForTesting  TelemetryLogger(Clock clock, Preferences preferences, URLStreamHandler urlStreamHandler); static TelemetryLogger get(); void logResultsForProject(ImmutableList<Suggestion> suggestions); void logErrorForProject(Exception e); void logResultsForBundle(
      File bundleFile, ImmutableList<Suggestion> suggestions); void logErrorForBundle(Exception e);  }
@Test public void logResultsForProject() throws Exception { ImmutableList<Suggestion> suggestions = ImmutableList.of( Suggestion.create( IssueType.QUESTIONABLE_FILE, Category.LARGE_FILES, SOME_PAYLOAD, SOME_MESSAGE, 1000L, null), Suggestion.create( IssueType.QUESTIONABLE_FILE, Category.LARGE_FILES, SOME_PAYLOAD, SOME_MESSAGE, 1000L, null), Suggestion.create( IssueType.LARGE_FILES_DYNAMIC_FEATURE, Category.LARGE_FILES, SOME_PAYLOAD, SOME_MESSAGE, 5000L, null)); telemetryLogger.logResultsForProject(suggestions); assertThat(clearcutConnection.getHeadersSetByClient().get("Cookie")).contains("NID="); LogRequest logRequest = inflatePayload(clearcutConnection); assertCommonLogFields(logRequest); SizeAnalysisLog sizeAnalysisLog = extractSourceExtension(logRequest); assertThat(sizeAnalysisLog.getAnalyzerVersion()).isEqualTo(Version.CURRENT_VERSION); assertThat(sizeAnalysisLog.getArtifactType()).isEqualTo(ArtifactType.PROJECT_DIR); assertThat(sizeAnalysisLog.getErrorType()).isEqualTo(ErrorType.NO_ERROR); assertThat(sizeAnalysisLog.getSuggestionsByIssueTypeList()) .containsExactly( SuggestionsByIssueType.newBuilder() .setCategory("LARGE_FILES") .setIssueType("QUESTIONABLE_FILE") .setSuggestionCount(2) .setEstimatedSavingsBytes(2000) .build(), SuggestionsByIssueType.newBuilder() .setCategory("LARGE_FILES") .setIssueType("LARGE_FILES_DYNAMIC_FEATURE") .setSuggestionCount(1) .setEstimatedSavingsBytes(5000) .build()); assertThat(sizeAnalysisLog.hasBundleSizeBreakdown()).isFalse(); }