TelemetryLogger { public void logResultsForBundle( File bundleFile, ImmutableList<Suggestion> suggestions) { uploadLogs( buildResultLog(suggestions, null) .setArtifactType(ArtifactType.APP_BUNDLE) .setBundleSizeBreakdown(computeBundleSizeBreakdown(bundleFile))); } @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 logResultsForBundle() throws Exception { File bundle = TestUtils.getTestDataFile("app.aab"); ImmutableList<Suggestion> suggestions = ImmutableList.of( Suggestion.create( IssueType.WEBP, Category.WEBP, SOME_PAYLOAD, SOME_MESSAGE, 1000L, null)); telemetryLogger.logResultsForBundle(bundle, 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.APP_BUNDLE); assertThat(sizeAnalysisLog.getErrorType()).isEqualTo(ErrorType.NO_ERROR); assertThat(sizeAnalysisLog.getSuggestionsByIssueTypeList()) .containsExactly( SuggestionsByIssueType.newBuilder() .setCategory("WEBP") .setIssueType("WEBP") .setSuggestionCount(1) .setEstimatedSavingsBytes(1000) .build()); assertThat(sizeAnalysisLog.getBundleSizeBreakdown()) .isEqualTo( BundleSizeBreakdown.newBuilder() .setAabFileBytes(1408000) .setDexBytes(2211000) .setResourceFileBytes(363000) .setResourcePbBytes(462000) .build()); }