### Question:
BuildContext implements Closeable { @VisibleForTesting String makeUserAgent() { if (!JibSystemProperties.isUserAgentEnabled()) { return ""; } StringBuilder userAgentBuilder = new StringBuilder("jib"); userAgentBuilder.append(" ").append(toolVersion); userAgentBuilder.append(" ").append(toolName); if (!Strings.isNullOrEmpty(System.getProperty(JibSystemProperties.UPSTREAM_CLIENT))) { userAgentBuilder.append(" ").append(System.getProperty(JibSystemProperties.UPSTREAM_CLIENT)); } return userAgentBuilder.toString(); } private  BuildContext(
      ImageConfiguration baseImageConfiguration,
      ImageConfiguration targetImageConfiguration,
      ImmutableSet<String> additionalTargetImageTags,
      ContainerConfiguration containerConfiguration,
      Cache baseImageLayersCache,
      Cache applicationLayersCache,
      Class<? extends BuildableManifestTemplate> targetFormat,
      boolean offline,
      ImmutableList<FileEntriesLayer> layerConfigurations,
      String toolName,
      @Nullable String toolVersion,
      EventHandlers eventHandlers,
      FailoverHttpClient httpClient,
      ExecutorService executorService,
      boolean shutDownExecutorService,
      boolean alwaysCacheBaseImage); static Builder builder(); ImageConfiguration getBaseImageConfiguration(); ImageConfiguration getTargetImageConfiguration(); ImmutableSet<String> getAllTargetImageTags(); ContainerConfiguration getContainerConfiguration(); Class<? extends BuildableManifestTemplate> getTargetFormat(); String getToolName(); @Nullable String getToolVersion(); EventHandlers getEventHandlers(); ExecutorService getExecutorService(); Cache getBaseImageLayersCache(); Cache getApplicationLayersCache(); boolean isOffline(); boolean getAlwaysCacheBaseImage(); ImmutableList<FileEntriesLayer> getLayerConfigurations(); RegistryClient.Factory newBaseImageRegistryClientFactory(); RegistryClient.Factory newTargetImageRegistryClientFactory(); @Override void close();  }### Answer:
@Test public void testGetUserAgent_unset() throws CacheDirectoryCreationException { BuildContext buildContext = createBasicTestBuilder().build(); String generatedUserAgent = buildContext.makeUserAgent(); Assert.assertEquals("jib null jib", generatedUserAgent); }
@Test public void testGetUserAgent_withValues() throws CacheDirectoryCreationException { BuildContext buildContext = createBasicTestBuilder().setToolName("test-name").setToolVersion("test-version").build(); String generatedUserAgent = buildContext.makeUserAgent(); Assert.assertEquals("jib test-version test-name", generatedUserAgent); }
@Test public void testGetUserAgentWithUpstreamClient() throws CacheDirectoryCreationException { System.setProperty(JibSystemProperties.UPSTREAM_CLIENT, "skaffold/0.34.0"); BuildContext buildContext = createBasicTestBuilder().setToolName("test-name").setToolVersion("test-version").build(); String generatedUserAgent = buildContext.makeUserAgent(); Assert.assertEquals("jib test-version test-name skaffold/0.34.0", generatedUserAgent); }