public Builder toBuilder() {
    return builder()
        .setBaseImage(baseImage)
        .setPlatforms(platforms)
        .setCreationTime(creationTime)
        .setFormat(format)
        .setEnvironment(environment)
        .setLabels(labels)
        .setVolumes(volumes)
        .setExposedPorts(exposedPorts)
        .setUser(user)
        .setWorkingDirectory(workingDirectory)
        .setEntrypoint(entrypoint)
        .setCmd(cmd)
        .setLayers(layers);
  }
@Test
  public void testToBuilder() {
    ContainerBuildPlan plan = createSamplePlan().toBuilder().build();

    Assert.assertEquals("base/image", plan.getBaseImage());
    Assert.assertEquals(
        ImmutableSet.of(new Platform("testOs", "testArchitecture")), plan.getPlatforms());
    Assert.assertEquals(ImageFormat.OCI, plan.getFormat());
    Assert.assertEquals(Instant.ofEpochMilli(30), plan.getCreationTime());
    Assert.assertEquals(ImmutableMap.of("env", "var"), plan.getEnvironment());
    Assert.assertEquals(
        ImmutableSet.of(AbsoluteUnixPath.get("/mnt/foo"), AbsoluteUnixPath.get("/bar")),
        plan.getVolumes());
    Assert.assertEquals(ImmutableMap.of("com.example.label", "cool"), plan.getLabels());
    Assert.assertEquals(ImmutableSet.of(Port.tcp(443)), plan.getExposedPorts());
    Assert.assertEquals(":", plan.getUser());
    Assert.assertEquals(AbsoluteUnixPath.get("/workspace"), plan.getWorkingDirectory());
    Assert.assertEquals(Arrays.asList("foo", "entrypoint"), plan.getEntrypoint());
    Assert.assertEquals(Arrays.asList("bar", "cmd"), plan.getCmd());

    Assert.assertEquals(1, plan.getLayers().size());
    MatcherAssert.assertThat(
        plan.getLayers().get(0), CoreMatchers.instanceOf(FileEntriesLayer.class));
    Assert.assertEquals(
        Arrays.asList(
            new FileEntry(
                Paths.get("/src/file/foo"),
                AbsoluteUnixPath.get("/path/in/container"),
                FilePermissions.fromOctalString("644"),
                Instant.ofEpochSecond(1))),
        ((FileEntriesLayer) plan.getLayers().get(0)).getEntries());
  }