GoTimeUtilTest : Remove call to Optional.get()
without isPresent()
check
#2970
Labels
Milestone
Optional.get()
without isPresent()
check
#2970
Component
JKube Kit
Task description
Description
In GoTimeUtilTest, we're directly calling
Optional.get()
without checking whether there is any element present in the Optional, this might causeNoSuchElementException
:jkube/jkube-kit/enricher/api/src/test/java/org/eclipse/jkube/kit/enricher/api/util/GoTimeUtilTest.java
Lines 32 to 36 in d9d630b
We should check whether
Optional.isPresent()
returns true, then only fetch the value. We can rely on AssertJ's builtinisPresent()
andcontains(..)
DSL methods to verify these things for us.Expected Behavior
.isPresent()
is added before directly checking value inside OptionalAcceptance Criteria
Optional.get()
The text was updated successfully, but these errors were encountered: