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

Code before:
    System.setProperty("jib.container.entrypoint", "entry1,entry2,entry3");
    assertThat(testJibExtension.getContainer().getEntrypoint())
        .containsExactly("entry1", "entry2", "entry3")
        .inOrder();
    System.setProperty("jib.container.environment", "env1=val1,env2=val2");
    assertThat(testJibExtension.getContainer().getEnvironment())
        .containsExactly("env1", "val1", "env2", "val2")
        .inOrder();
    System.setProperty("jib.container.extraClasspath", "/d1,/d2,/d3");
    assertThat(testJibExtension.getContainer().getExtraClasspath())
        .containsExactly("/d1", "/d2", "/d3")
        .inOrder();
    System.setProperty("jib.container.expandClasspathDependencies", "true");
    assertTrue(testJibExtension.getContainer().getExpandClasspathDependencies());
    System.setProperty("jib.container.format", "OCI");
    assertThat(testJibExtension.getContainer().getFormat()).isSameInstanceAs(ImageFormat.OCI);
    System.setProperty("jib.container.jvmFlags", "flag1,flag2,flag3");
    assertThat(testJibExtension.getContainer().getJvmFlags())
        .containsExactly("flag1", "flag2", "flag3")
        .inOrder();
    System.setProperty("jib.container.labels", "label1=val1,label2=val2");
    assertThat(testJibExtension.getContainer().getLabels().get())
        .containsExactly("label1", "val1", "label2", "val2")
        .inOrder();
    System.clearProperty("jib.container.labels");
    assertThat(testJibExtension.getContainer().getLabels().get())
        .containsExactly("label1", "val1", "label2", "val2")
        .inOrder();
    System.setProperty("jib.container.mainClass", "main");
    assertThat(testJibExtension.getContainer().getMainClass()).isEqualTo("main");
    System.setProperty("jib.container.ports", "port1,port2,port3");
    assertThat(testJibExtension.getContainer().getPorts())
        .containsExactly("port1", "port2", "port3")
        .inOrder();
    System.setProperty("jib.container.user", "myUser");
    assertThat(testJibExtension.getContainer().getUser()).isEqualTo("myUser");
    System.setProperty("jib.container.filesModificationTime", "2011-12-03T22:42:05Z");
    assertThat(testJibExtension.getContainer().getFilesModificationTime())
        .isEqualTo("2011-12-03T22:42:05Z");
    System.setProperty("jib.containerizingMode", "packaged");
    assertThat(testJibExtension.getContainerizingMode()).isEqualTo("packaged");

    System.setProperty("jib.extraDirectories.paths", "/foo,/bar/baz");
    assertThat(testJibExtension.getExtraDirectories().getPaths()).hasSize(2);
    assertThat(testJibExtension.getExtraDirectories().getPaths().get(0).getFrom())
        .isEqualTo(Paths.get("/foo"));
    assertThat(testJibExtension.getExtraDirectories().getPaths().get(1).getFrom())
        .isEqualTo(Paths.get("/bar/baz"));
    System.setProperty("jib.extraDirectories.permissions", "/foo/bar=707,/baz=456");
    assertThat(testJibExtension.getExtraDirectories().getPermissions())
        .containsExactly("/foo/bar", "707", "/baz", "456")

Review comment (suggestion):
I think we don't need additional `assertThat()` followed by `System.clearProperty()`. I'd revert the change here.

Code after:
        .inOrder();
    System.setProperty("jib.container.entrypoint", "entry1,entry2,entry3");
    assertThat(testJibExtension.getContainer().getEntrypoint())
        .containsExactly("entry1", "entry2", "entry3")
        .inOrder();
    System.setProperty("jib.container.environment", "env1=val1,env2=val2");
    assertThat(testJibExtension.getContainer().getEnvironment())
        .containsExactly("env1", "val1", "env2", "val2")
        .inOrder();
    System.setProperty("jib.container.extraClasspath", "/d1,/d2,/d3");
    assertThat(testJibExtension.getContainer().getExtraClasspath())
        .containsExactly("/d1", "/d2", "/d3")
        .inOrder();
    System.setProperty("jib.container.expandClasspathDependencies", "true");
    assertTrue(testJibExtension.getContainer().getExpandClasspathDependencies());
    System.setProperty("jib.container.format", "OCI");
    assertThat(testJibExtension.getContainer().getFormat()).isSameInstanceAs(ImageFormat.OCI);
    System.setProperty("jib.container.jvmFlags", "flag1,flag2,flag3");
    assertThat(testJibExtension.getContainer().getJvmFlags())
        .containsExactly("flag1", "flag2", "flag3")
        .inOrder();
    System.setProperty("jib.container.labels", "label1=val1,label2=val2");
    assertThat(testJibExtension.getContainer().getLabels().get())
        .containsExactly("label1", "val1", "label2", "val2")
        .inOrder();
    System.setProperty("jib.container.mainClass", "main");
    assertThat(testJibExtension.getContainer().getMainClass()).isEqualTo("main");
    System.setProperty("jib.container.ports", "port1,port2,port3");
    assertThat(testJibExtension.getContainer().getPorts())
        .containsExactly("port1", "port2", "port3")
        .inOrder();
    System.setProperty("jib.container.user", "myUser");
    assertThat(testJibExtension.getContainer().getUser()).isEqualTo("myUser");
    System.setProperty("jib.container.filesModificationTime", "2011-12-03T22:42:05Z");
    assertThat(testJibExtension.getContainer().getFilesModificationTime())
        .isEqualTo("2011-12-03T22:42:05Z");
    System.setProperty("jib.containerizingMode", "packaged");
    assertThat(testJibExtension.getContainerizingMode()).isEqualTo("packaged");

    System.setProperty("jib.extraDirectories.paths", "/foo,/bar/baz");
    assertThat(testJibExtension.getExtraDirectories().getPaths()).hasSize(2);
    assertThat(testJibExtension.getExtraDirectories().getPaths().get(0).getFrom())
        .isEqualTo(Paths.get("/foo"));
    assertThat(testJibExtension.getExtraDirectories().getPaths().get(1).getFrom())
        .isEqualTo(Paths.get("/bar/baz"));
    System.setProperty("jib.extraDirectories.permissions", "/foo/bar=707,/baz=456");
    assertThat(testJibExtension.getExtraDirectories().getPermissions())
        .containsExactly("/foo/bar", "707", "/baz", "456")
        .inOrder();

    System.setProperty("jib.dockerClient.executable", "test-exec");