Repository: GoogleContainerTools/jib
File: jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/JibExtensionTest.java (Java)

Code before:
  public void testContainer() {
    assertThat(testJibExtension.getContainer().getJvmFlags()).isEmpty();
    assertThat(testJibExtension.getContainer().getEnvironment()).isEmpty();
    assertThat(testJibExtension.getContainer().getExtraClasspath()).isEmpty();
    assertThat(testJibExtension.getContainer().getExpandClasspathDependencies()).isFalse();
    assertThat(testJibExtension.getContainer().getMainClass()).isNull();
    assertThat(testJibExtension.getContainer().getArgs()).isNull();
    assertThat(testJibExtension.getContainer().getFormat()).isSameInstanceAs(ImageFormat.Docker);
    assertThat(testJibExtension.getContainer().getPorts()).isEmpty();
    assertThat(testJibExtension.getContainer().getAppRoot()).isEmpty();
    assertThat(testJibExtension.getContainer().getFilesModificationTime())
        .isEqualTo("EPOCH_PLUS_SECOND");
    assertThat(testJibExtension.getContainer().getCreationTime()).isEqualTo("EPOCH");

    testJibExtension.container(
        container -> {
          container.setJvmFlags(Arrays.asList("jvmFlag1", "jvmFlag2"));
          container.setEnvironment(ImmutableMap.of("var1", "value1", "var2", "value2"));
          container.setEntrypoint(Arrays.asList("foo", "bar", "baz"));
          container.setExtraClasspath(Arrays.asList("/d1", "/d2", "/d3"));
          container.setExpandClasspathDependencies(true);
          container.setMainClass("mainClass");
          container.setArgs(Arrays.asList("arg1", "arg2", "arg3"));
          container.setPorts(Arrays.asList("1000", "2000-2010", "3000"));
          container.setFormat(ImageFormat.OCI);
          container.setAppRoot("some invalid appRoot value");
          container.setFilesModificationTime("some invalid time value");
        });
    ContainerParameters container = testJibExtension.getContainer();
    assertThat(container.getEntrypoint()).containsExactly("foo", "bar", "baz").inOrder();
    assertThat(container.getJvmFlags()).containsExactly("jvmFlag1", "jvmFlag2").inOrder();
    assertThat(container.getEnvironment())
        .containsExactly("var1", "value1", "var2", "value2")
        .inOrder();
    assertThat(container.getExtraClasspath()).containsExactly("/d1", "/d2", "/d3").inOrder();
    assertThat(testJibExtension.getContainer().getExpandClasspathDependencies()).isTrue();
    assertThat(testJibExtension.getContainer().getMainClass()).isEqualTo("mainClass");
    assertThat(container.getArgs()).containsExactly("arg1", "arg2", "arg3").inOrder();
    assertThat(container.getPorts()).containsExactly("1000", "2000-2010", "3000").inOrder();
    assertThat(container.getFormat()).isSameInstanceAs(ImageFormat.OCI);
    assertThat(container.getAppRoot()).isEqualTo("some invalid appRoot value");
    assertThat(container.getFilesModificationTime()).isEqualTo("some invalid time value");
  }

  @Test
  public void testContainerizingMode() {
    assertThat(testJibExtension.getContainerizingMode()).isEqualTo("exploded");
  }

  @Test
  public void testConfigurationName() {

Review comment (suggestion):
Maybe this can be
```
container.getLabels().set(...)
```
? Then I guess we can keep the `assertThat()` below that you removed.

Code after:
  public void testContainer() {
    assertThat(testJibExtension.getContainer().getJvmFlags()).isEmpty();
    assertThat(testJibExtension.getContainer().getEnvironment()).isEmpty();
    assertThat(testJibExtension.getContainer().getExtraClasspath()).isEmpty();
    assertThat(testJibExtension.getContainer().getExpandClasspathDependencies()).isFalse();
    assertThat(testJibExtension.getContainer().getMainClass()).isNull();
    assertThat(testJibExtension.getContainer().getArgs()).isNull();
    assertThat(testJibExtension.getContainer().getFormat()).isSameInstanceAs(ImageFormat.Docker);
    assertThat(testJibExtension.getContainer().getPorts()).isEmpty();
    assertThat(testJibExtension.getContainer().getLabels().get()).isEmpty();
    assertThat(testJibExtension.getContainer().getAppRoot()).isEmpty();
    assertThat(testJibExtension.getContainer().getFilesModificationTime())
        .isEqualTo("EPOCH_PLUS_SECOND");
    assertThat(testJibExtension.getContainer().getCreationTime()).isEqualTo("EPOCH");

    testJibExtension.container(
        container -> {
          container.setJvmFlags(Arrays.asList("jvmFlag1", "jvmFlag2"));
          container.setEnvironment(ImmutableMap.of("var1", "value1", "var2", "value2"));
          container.setEntrypoint(Arrays.asList("foo", "bar", "baz"));
          container.setExtraClasspath(Arrays.asList("/d1", "/d2", "/d3"));
          container.setExpandClasspathDependencies(true);
          container.setMainClass("mainClass");
          container.setArgs(Arrays.asList("arg1", "arg2", "arg3"));
          container.setPorts(Arrays.asList("1000", "2000-2010", "3000"));
          container.setFormat(ImageFormat.OCI);
          container.setAppRoot("some invalid appRoot value");
          container.setFilesModificationTime("some invalid time value");
        });
    ContainerParameters container = testJibExtension.getContainer();
    assertThat(container.getEntrypoint()).containsExactly("foo", "bar", "baz").inOrder();
    assertThat(container.getJvmFlags()).containsExactly("jvmFlag1", "jvmFlag2").inOrder();
    assertThat(container.getEnvironment())
        .containsExactly("var1", "value1", "var2", "value2")
        .inOrder();
    assertThat(container.getExtraClasspath()).containsExactly("/d1", "/d2", "/d3").inOrder();
    assertThat(testJibExtension.getContainer().getExpandClasspathDependencies()).isTrue();
    assertThat(testJibExtension.getContainer().getMainClass()).isEqualTo("mainClass");
    assertThat(container.getArgs()).containsExactly("arg1", "arg2", "arg3").inOrder();
    assertThat(container.getPorts()).containsExactly("1000", "2000-2010", "3000").inOrder();
    assertThat(container.getFormat()).isSameInstanceAs(ImageFormat.OCI);
    assertThat(container.getAppRoot()).isEqualTo("some invalid appRoot value");
    assertThat(container.getFilesModificationTime()).isEqualTo("some invalid time value");
  }

  @Test
  public void testContainerizingMode() {
    assertThat(testJibExtension.getContainerizingMode()).isEqualTo("exploded");
  }

  @Test