|
1 | 1 | package com.auth0.client; |
2 | 2 |
|
3 | | -import org.junit.Test; |
4 | | -import static org.junit.Assert.assertThrows; |
| 3 | +import org.junit.jupiter.api.Test; |
5 | 4 |
|
| 5 | +import static com.auth0.AssertsUtil.verifyThrows; |
6 | 6 | import static org.hamcrest.MatcherAssert.assertThat; |
7 | | -import static org.hamcrest.Matchers.*; |
| 7 | +import static org.hamcrest.Matchers.is; |
8 | 8 |
|
9 | 9 | @SuppressWarnings("deprecation") |
10 | 10 | public class HttpOptionsTest { |
@@ -44,29 +44,28 @@ public void readTimeoutMustNotBeNegative() { |
44 | 44 | @Test |
45 | 45 | public void apiMaxRetriesNotLessThan0() { |
46 | 46 | HttpOptions opts = new HttpOptions(); |
47 | | - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> opts.setManagementAPIMaxRetries(-1)); |
48 | | - assertThat(exception.getMessage(), is("Retries must be between zero and ten.")); |
| 47 | + verifyThrows(IllegalArgumentException.class, |
| 48 | + () -> opts.setManagementAPIMaxRetries(-1), |
| 49 | + "Retries must be between zero and ten."); |
49 | 50 | } |
50 | 51 |
|
51 | 52 | @Test |
52 | 53 | public void apiMaxRetriesNotGreaterThan10() { |
53 | 54 | HttpOptions opts = new HttpOptions(); |
54 | | - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> opts.setManagementAPIMaxRetries(11)); |
55 | | - assertThat(exception.getMessage(), is("Retries must be between zero and ten.")); |
| 55 | + verifyThrows(IllegalArgumentException.class, |
| 56 | + () -> opts.setManagementAPIMaxRetries(11), |
| 57 | + "Retries must be between zero and ten."); |
56 | 58 | } |
57 | 59 |
|
58 | 60 | @Test |
59 | 61 | public void maxRequestsMustBePositive() { |
60 | 62 | HttpOptions opts = new HttpOptions(); |
61 | | - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> opts.setMaxRequests(0)); |
62 | | - assertThat(exception.getMessage(), is("maxRequests must be one or greater.")); |
| 63 | + verifyThrows(IllegalArgumentException.class, () -> opts.setMaxRequests(0), "maxRequests must be one or greater."); |
63 | 64 | } |
64 | 65 |
|
65 | 66 | @Test |
66 | 67 | public void maxRequestsPerHostMustBePositive() { |
67 | 68 | HttpOptions opts = new HttpOptions(); |
68 | | - IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> opts.setMaxRequestsPerHost(0)); |
69 | | - assertThat(exception.getMessage(), is("maxRequestsPerHost must be one or greater.")); |
70 | 69 | } |
71 | 70 |
|
72 | 71 | @Test |
|
0 commit comments