Skip to content

Commit

Permalink
chore : fix ambigous references to assertThatThrownBy
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia authored and manusa committed Jan 2, 2024
1 parent 73ccfd4 commit de8e718
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.function.UnaryOperator;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertThrows;

Expand Down Expand Up @@ -319,11 +320,10 @@ void differentResourceVersionConflictEdit() {
.addToData("key", "changed")
.build());
// Then
assertThatThrownBy(patchedCmOp::patch)
.asInstanceOf(InstanceOfAssertFactories.type(KubernetesClientException.class))
assertThatExceptionOfType(KubernetesClientException.class)
.isThrownBy(patchedCmOp::patch)
.hasFieldOrPropertyWithValue("code", 409)
.extracting(KubernetesClientException::getMessage).asString()
.contains("the object has been modified;");
.withMessageContaining("the object has been modified;");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.stream.Stream;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -231,8 +232,9 @@ void testRequestTimeout() {
});

Awaitility.await().atMost(10, TimeUnit.SECONDS).until(consumeFuture::isDone);
assertThatThrownBy(consumeFuture::get)
.isInstanceOf(ExecutionException.class).hasCauseInstanceOf(TimeoutException.class);
assertThatExceptionOfType(ExecutionException.class)
.isThrownBy(consumeFuture::get)
.withCauseExactlyInstanceOf(TimeoutException.class);
}

@Test
Expand Down

0 comments on commit de8e718

Please sign in to comment.