From 6a3e71c6684133922c95e713d5e374a50d09ea99 Mon Sep 17 00:00:00 2001 From: Kushagra Sinha Date: Tue, 30 Apr 2024 15:10:57 +0530 Subject: [PATCH] test: GoTimeUtilTest asserts optional with assertj Update GoTimeUtilTest.java GoTimeUtilTest is refactored to not directly call Optional.get(). --- Merge pull request #1 from kushagrasinha123ks/kushagra/issue#2970 Update GoTimeUtilTest.java --- Revert "Update GoTimeUtilTest.java" --- Merge pull request #2 from kushagrasinha123ks/revert-1-kushagra/issue#2970 Revert "Update GoTimeUtilTest.java" --- Update GoTimeUtilTest.java GoTimeUtilTest is refactored to not directly call Optional.get(). --- Update GoTimeUtilTest.java inlined the method calls in conversion function --- Update GoTimeUtilTest.java removed the unused imports. --- .../eclipse/jkube/kit/enricher/api/util/GoTimeUtilTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/api/util/GoTimeUtilTest.java b/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/api/util/GoTimeUtilTest.java index eca8f17ecd..359256ebef 100644 --- a/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/api/util/GoTimeUtilTest.java +++ b/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/api/util/GoTimeUtilTest.java @@ -32,8 +32,7 @@ class GoTimeUtilTest { @ParameterizedTest(name = "duration ''{0}'' should be ''{1}'' seconds") @MethodSource("data") void conversion(String duration, int expectedDuration) { - int result = GoTimeUtil.durationSeconds(duration).get(); - assertThat(result).isEqualTo(expectedDuration); + assertThat(GoTimeUtil.durationSeconds(duration)).isPresent().contains(expectedDuration); } static Stream data() {