Repository: GoogleContainerTools/jib
File: jib-cli/src/test/java/com/google/cloud/tools/jib/cli/buildfile/BuildFilesTest.java (Java)

Code before:
import com.google.common.io.Resources;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.util.Map;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

public class BuildFilesTest {

  @Rule public final TemporaryFolder tmp = new TemporaryFolder();
  @Rule public MockitoRule rule = MockitoJUnit.rule();

  @Mock ConsoleLogger consoleLogger;
  @Mock JibCli jibCli;

  @Before
  public void setUp() {
    Mockito.when(jibCli.getTemplateParameters()).thenReturn(ImmutableMap.of());
  }

  @Test
  public void testToJibContainerBuilder_allProperties()
      throws URISyntaxException, IOException, InvalidImageReferenceException {
    Path buildfile =
        Paths.get(Resources.getResource("buildfiles/projects/allProperties/jib.yaml").toURI());
    Path projectRoot = buildfile.getParent();
    JibContainerBuilder jibContainerBuilder =
        BuildFiles.toJibContainerBuilder(projectRoot, buildfile, jibCli, consoleLogger);

    ContainerBuildPlan resolved = jibContainerBuilder.toContainerBuildPlan();
    Assert.assertEquals("ubuntu", resolved.getBaseImage());
    Assert.assertEquals(Instant.ofEpochMilli(2000), resolved.getCreationTime());
    Assert.assertEquals(ImageFormat.OCI, resolved.getFormat());
    Assert.assertEquals(
        ImmutableSet.of(new Platform("arm", "linux"), new Platform("amd64", "darwin")),
        resolved.getPlatforms());
    Assert.assertEquals(ImmutableMap.of("KEY1", "v1", "KEY2", "v2"), resolved.getEnvironment());
    Assert.assertEquals(
        ImmutableSet.of(AbsoluteUnixPath.get("/volume1"), AbsoluteUnixPath.get("/volume2")),

Review comment (suggestion):
```suggestion
  @Rule public final MockitoRule rule = MockitoJUnit.rule();

  @Mock private ConsoleLogger consoleLogger;
  @Mock private JibCli jibCli;
```

Code after:
import com.google.common.io.Resources;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.util.Map;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;

public class BuildFilesTest {

  @Rule public final TemporaryFolder tmp = new TemporaryFolder();
  @Rule public final MockitoRule rule = MockitoJUnit.rule();

  @Mock private ConsoleLogger consoleLogger;
  @Mock private JibCli jibCli;

  @Before
  public void setUp() {
    Mockito.when(jibCli.getTemplateParameters()).thenReturn(ImmutableMap.of());
  }

  @Test
  public void testToJibContainerBuilder_allProperties()
      throws URISyntaxException, IOException, InvalidImageReferenceException {
    Path buildfile =
        Paths.get(Resources.getResource("buildfiles/projects/allProperties/jib.yaml").toURI());
    Path projectRoot = buildfile.getParent();
    JibContainerBuilder jibContainerBuilder =
        BuildFiles.toJibContainerBuilder(projectRoot, buildfile, jibCli, consoleLogger);

    ContainerBuildPlan resolved = jibContainerBuilder.toContainerBuildPlan();
    Assert.assertEquals("ubuntu", resolved.getBaseImage());
    Assert.assertEquals(Instant.ofEpochMilli(2000), resolved.getCreationTime());
    Assert.assertEquals(ImageFormat.OCI, resolved.getFormat());
    Assert.assertEquals(
        ImmutableSet.of(new Platform("arm", "linux"), new Platform("amd64", "darwin")),
        resolved.getPlatforms());
    Assert.assertEquals(ImmutableMap.of("KEY1", "v1", "KEY2", "v2"), resolved.getEnvironment());
    Assert.assertEquals(
        ImmutableSet.of(AbsoluteUnixPath.get("/volume1"), AbsoluteUnixPath.get("/volume2")),