public static Builder builder() {
    return new Builder();
  }
@Test
  public void testBuilder_missingValues() throws CacheDirectoryCreationException {
    // Target image is missing
    try {
      BuildContext.builder()
          .setBaseImageConfiguration(
              ImageConfiguration.builder(Mockito.mock(ImageReference.class)).build())
          .setBaseImageLayersCacheDirectory(Paths.get("ignored"))
          .setContainerConfiguration(ContainerConfiguration.builder().build())
          .setApplicationLayersCacheDirectory(Paths.get("ignored"))
          .build();
      Assert.fail("BuildContext should not be built with missing values");

    } catch (IllegalStateException ex) {
      Assert.assertEquals("target image configuration is required but not set", ex.getMessage());
    }

    // Two required fields missing
    try {
      BuildContext.builder()
          .setBaseImageLayersCacheDirectory(Paths.get("ignored"))
          .setApplicationLayersCacheDirectory(Paths.get("ignored"))
          .setContainerConfiguration(ContainerConfiguration.builder().build())
          .build();
      Assert.fail("BuildContext should not be built with missing values");

    } catch (IllegalStateException ex) {
      Assert.assertEquals(
          "base image configuration and target image configuration are required but not set",
          ex.getMessage());
    }

    // All required fields missing
    try {
      BuildContext.builder().build();
      Assert.fail("BuildContext should not be built with missing values");

    } catch (IllegalStateException ex) {
      Assert.assertEquals(
          "base image configuration, target image configuration, container configuration, base "
              + "image layers cache directory, and application layers cache directory are required "
              + "but not set",
          ex.getMessage());
    }
  }