@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();
  }
@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);
  }