From f3861006469a4ed577707615598cb9220156a1e8 Mon Sep 17 00:00:00 2001 From: Clayton Walker Date: Mon, 22 Jan 2024 19:52:46 -0700 Subject: [PATCH] Fix warning --- .../cloud/tools/jib/builder/steps/StepsRunnerTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/StepsRunnerTest.java b/jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/StepsRunnerTest.java index e8a60de2d5..3f41b43c38 100644 --- a/jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/StepsRunnerTest.java +++ b/jib-core/src/test/java/com/google/cloud/tools/jib/builder/steps/StepsRunnerTest.java @@ -155,8 +155,9 @@ public void testObtainBaseImageLayers_skipObtainingDuplicateLayers() @Test public void testIsImagePushed_skipExistingEnabledAndManifestPresent() { - Optional> manifestResult = Mockito.mock(Optional.class); - Mockito.when(manifestResult.isPresent()).thenReturn(true); + @SuppressWarnings("unchecked") + Optional> manifestResult = + Optional.of(Mockito.mock(ManifestAndDigest.class)); System.setProperty(JibSystemProperties.SKIP_EXISTING_IMAGES, "true"); Assert.assertFalse(stepsRunner.isImagePushed(manifestResult)); @@ -164,7 +165,7 @@ public void testIsImagePushed_skipExistingEnabledAndManifestPresent() { @Test public void testIsImagePushed_skipExistingImageDisabledAndManifestPresent() { - Optional> manifestResult = Mockito.mock(Optional.class); + Optional> manifestResult = Optional.empty(); System.setProperty(JibSystemProperties.SKIP_EXISTING_IMAGES, "false"); Assert.assertTrue(stepsRunner.isImagePushed(manifestResult)); @@ -172,9 +173,8 @@ public void testIsImagePushed_skipExistingImageDisabledAndManifestPresent() { @Test public void testIsImagePushed_skipExistingImageEnabledAndManifestNotPresent() { - Optional> manifestResult = Mockito.mock(Optional.class); + Optional> manifestResult = Optional.empty(); System.setProperty(JibSystemProperties.SKIP_EXISTING_IMAGES, "true"); - Mockito.when(manifestResult.isPresent()).thenReturn(false); Assert.assertTrue(stepsRunner.isImagePushed(manifestResult)); }