Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshug committed Dec 26, 2020
1 parent 9276dc2 commit 9cb357c
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -25,6 +25,8 @@
import io.kubernetes.client.extended.leaderelection.LeaderElector;
import io.kubernetes.client.extended.leaderelection.Lock;
import io.kubernetes.client.openapi.ApiException;

import java.net.HttpURLConnection;
import java.time.Duration;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Test;
Expand Down Expand Up @@ -56,8 +58,9 @@ public void testLeaderElectingController() throws ApiException {
record.set(new LeaderElectionRecord());

when(mockLock.identity()).thenReturn("foo");

doAnswer(invocationOnMock -> record.get()).when(mockLock).get();
when(mockLock.get())
.thenThrow(new ApiException("Record Not Found", HttpURLConnection.HTTP_NOT_FOUND, null, null))
.thenReturn(record.get());

doAnswer(
invocationOnMock -> {
Expand Down

0 comments on commit 9cb357c

Please sign in to comment.