Skip to content

Commit a70bb73

Browse files
committed
fix test
1 parent 9276dc2 commit a70bb73

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

extended/src/test/java/io/kubernetes/client/extended/controller/LeaderElectingControllerTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import io.kubernetes.client.extended.leaderelection.LeaderElector;
2626
import io.kubernetes.client.extended.leaderelection.Lock;
2727
import io.kubernetes.client.openapi.ApiException;
28+
import java.net.HttpURLConnection;
2829
import java.time.Duration;
2930
import java.util.concurrent.atomic.AtomicReference;
3031
import org.junit.Test;
@@ -56,8 +57,10 @@ public void testLeaderElectingController() throws ApiException {
5657
record.set(new LeaderElectionRecord());
5758

5859
when(mockLock.identity()).thenReturn("foo");
59-
60-
doAnswer(invocationOnMock -> record.get()).when(mockLock).get();
60+
when(mockLock.get())
61+
.thenThrow(
62+
new ApiException("Record Not Found", HttpURLConnection.HTTP_NOT_FOUND, null, null))
63+
.thenReturn(record.get());
6164

6265
doAnswer(
6366
invocationOnMock -> {

0 commit comments

Comments
 (0)