// Path: provider/src/main/java/com/cloudera/director/google/compute/util/ComputeUrls.java
// public class ComputeUrls {
// 
//   private ComputeUrls() {}
// 
//   public static String buildDiskTypeUrl(String projectId, String zone, String dataDiskType) {
//     String diskTypePath;
// 
//     if (dataDiskType.equals("LocalSSD")) {
//       diskTypePath = "local-ssd";
//     } else if (dataDiskType.equals("SSD")) {
//       diskTypePath = "pd-ssd";
//     } else {
//       // The value will already have been checked by the validator.
//       // Assume 'Standard'.
//       diskTypePath = "pd-standard";
//     }
// 
//     return buildZonalUrl(projectId, zone, "diskTypes", diskTypePath);
//   }
// 
//   public static String buildDiskUrl(String projectId, String zone, String diskName) {
//     return buildZonalUrl(projectId, zone, "disks", diskName);
//   }
// 
//   public static String buildMachineTypeUrl(String projectId, String zone, String machineType) {
//     return buildZonalUrl(projectId, zone, "machineTypes", machineType);
//   }
// 
//   public static String buildNetworkUrl(String projectId, String networkName) {
//     return buildGlobalUrl(projectId, "networks", networkName);
//   }
// 
//   public static String buildSubnetUrl(String projectId, String region, String subnetName){
//     return buildRegionalUrl(projectId, region, "subnetworks", subnetName);
//   }
// 
//   public static String buildZonalUrl(String projectId, String zone, String... resourcePathParts) {
//     List<String> pathParts = Lists.newArrayList("zones", zone);
// 
//     if (resourcePathParts != null) {
//       pathParts.addAll(Lists.newArrayList(resourcePathParts));
//     }
// 
//     return buildGoogleComputeApisUrl(projectId, Iterables.toArray(pathParts, String.class));
//   }
// 
//   public static String buildRegionalUrl(String projectId, String region, String... resourcePathParts) {
//     List<String> pathParts = Lists.newArrayList("regions", region);
// 
//     if (resourcePathParts != null) {
//       pathParts.addAll(Lists.newArrayList(resourcePathParts));
//     }
// 
//     return buildGoogleComputeApisUrl(projectId, Iterables.toArray(pathParts, String.class));
//   }
// 
//   public static String buildGlobalUrl(String projectId, String... resourcePathParts) {
//     List<String> pathParts = Lists.newArrayList("global");
// 
//     if (resourcePathParts != null) {
//       pathParts.addAll(Lists.newArrayList(resourcePathParts));
//     }
// 
//     return buildGoogleComputeApisUrl(projectId, Iterables.toArray(pathParts, String.class));
//   }
// 
//   static String buildGoogleComputeApisUrl(String projectId, String... resourcePathParts) {
//     return Urls.buildGenericApisUrl("compute", "v1", projectId, resourcePathParts);
//   }
// }


import static junit.framework.Assert.fail;
import static org.assertj.core.api.Assertions.assertThat;
import com.cloudera.director.google.compute.util.ComputeUrls;
import org.junit.Test;
import java.net.MalformedURLException;
      Urls.getProject(someUrl);

      fail("An exception should have been thrown when we attempted to parse a malformed url.");
    } catch (IllegalArgumentException e) {
      assertThat(e.getMessage()).isEqualTo(String.format(Urls.MALFORMED_RESOURCE_URL_MSG, someUrl));
    }

    someUrl = "https://www.googleapis.com/compute/v1/projects/rhel-cloud/images/rhel-6-v20150526";

    try {
      Urls.getProject(someUrl);

      fail("An exception should have been thrown when we attempted to parse a malformed url.");
    } catch (IllegalArgumentException e) {
      assertThat(e.getMessage()).isEqualTo(String.format(Urls.MALFORMED_RESOURCE_URL_MSG, someUrl));
    }
  }

  @Test
  public void testGetProject_Null() {
    assertThat(Urls.getProject(null)).isEqualTo(null);
  }

  @Test
  public void testGetProject_EmptyString() {
    assertThat(Urls.getProject("")).isEqualTo(null);
  }

  @Test
  public void testBuildZonalUrl() {
// Path: provider/src/main/java/com/cloudera/director/google/compute/util/ComputeUrls.java
// public class ComputeUrls {
// 
//   private ComputeUrls() {}
// 
//   public static String buildDiskTypeUrl(String projectId, String zone, String dataDiskType) {
//     String diskTypePath;
// 
//     if (dataDiskType.equals("LocalSSD")) {
//       diskTypePath = "local-ssd";
//     } else if (dataDiskType.equals("SSD")) {
//       diskTypePath = "pd-ssd";
//     } else {
//       // The value will already have been checked by the validator.
//       // Assume 'Standard'.
//       diskTypePath = "pd-standard";
//     }
// 
//     return buildZonalUrl(projectId, zone, "diskTypes", diskTypePath);
//   }
// 
//   public static String buildDiskUrl(String projectId, String zone, String diskName) {
//     return buildZonalUrl(projectId, zone, "disks", diskName);
//   }
// 
//   public static String buildMachineTypeUrl(String projectId, String zone, String machineType) {
//     return buildZonalUrl(projectId, zone, "machineTypes", machineType);
//   }
// 
//   public static String buildNetworkUrl(String projectId, String networkName) {
//     return buildGlobalUrl(projectId, "networks", networkName);
//   }
// 
//   public static String buildSubnetUrl(String projectId, String region, String subnetName){
//     return buildRegionalUrl(projectId, region, "subnetworks", subnetName);
//   }
// 
//   public static String buildZonalUrl(String projectId, String zone, String... resourcePathParts) {
//     List<String> pathParts = Lists.newArrayList("zones", zone);
// 
//     if (resourcePathParts != null) {
//       pathParts.addAll(Lists.newArrayList(resourcePathParts));
//     }
// 
//     return buildGoogleComputeApisUrl(projectId, Iterables.toArray(pathParts, String.class));
//   }
// 
//   public static String buildRegionalUrl(String projectId, String region, String... resourcePathParts) {
//     List<String> pathParts = Lists.newArrayList("regions", region);
// 
//     if (resourcePathParts != null) {
//       pathParts.addAll(Lists.newArrayList(resourcePathParts));
//     }
// 
//     return buildGoogleComputeApisUrl(projectId, Iterables.toArray(pathParts, String.class));
//   }
// 
//   public static String buildGlobalUrl(String projectId, String... resourcePathParts) {
//     List<String> pathParts = Lists.newArrayList("global");
// 
//     if (resourcePathParts != null) {
//       pathParts.addAll(Lists.newArrayList(resourcePathParts));
//     }
// 
//     return buildGoogleComputeApisUrl(projectId, Iterables.toArray(pathParts, String.class));
//   }
// 
//   static String buildGoogleComputeApisUrl(String projectId, String... resourcePathParts) {
//     return Urls.buildGenericApisUrl("compute", "v1", projectId, resourcePathParts);
//   }
// }


// Path: tests/src/test/java/com/cloudera/director/google/util/UrlsTest.java
import static junit.framework.Assert.fail;
import static org.assertj.core.api.Assertions.assertThat;
import com.cloudera.director.google.compute.util.ComputeUrls;
import org.junit.Test;
import java.net.MalformedURLException;

      Urls.getProject(someUrl);

      fail("An exception should have been thrown when we attempted to parse a malformed url.");
    } catch (IllegalArgumentException e) {
      assertThat(e.getMessage()).isEqualTo(String.format(Urls.MALFORMED_RESOURCE_URL_MSG, someUrl));
    }

    someUrl = "https://www.googleapis.com/compute/v1/projects/rhel-cloud/images/rhel-6-v20150526";

    try {
      Urls.getProject(someUrl);

      fail("An exception should have been thrown when we attempted to parse a malformed url.");
    } catch (IllegalArgumentException e) {
      assertThat(e.getMessage()).isEqualTo(String.format(Urls.MALFORMED_RESOURCE_URL_MSG, someUrl));
    }
  }

  @Test
  public void testGetProject_Null() {
    assertThat(Urls.getProject(null)).isEqualTo(null);
  }

  @Test
  public void testGetProject_EmptyString() {
    assertThat(Urls.getProject("")).isEqualTo(null);
  }

  @Test
  public void testBuildZonalUrl() {
    assertThat(ComputeUrls.buildZonalUrl("some-project", "us-central1-f")).endsWith("/some-project/zones/us-central1-f");