|
36 | 36 | import org.junit.jupiter.api.Assertions;
|
37 | 37 | import org.junit.jupiter.api.BeforeEach;
|
38 | 38 | import org.junit.jupiter.api.TestTemplate;
|
39 |
| -import org.junit.jupiter.params.ParameterizedTest; |
40 |
| -import org.junit.jupiter.params.provider.ValueSource; |
41 | 39 | import tech.pegasys.teku.api.exceptions.RemoteServiceNotAvailableException;
|
42 | 40 | import tech.pegasys.teku.api.response.v1.beacon.ValidatorStatus;
|
43 | 41 | import tech.pegasys.teku.ethereum.json.types.beacon.StateValidatorData;
|
@@ -361,11 +359,17 @@ public void postValidators_WhenNoContent_ReturnsEmpty() {
|
361 | 359 | assertThat(okHttpValidatorTypeDefClient.postStateValidators(List.of("1"))).isEmpty();
|
362 | 360 | }
|
363 | 361 |
|
364 |
| - @ParameterizedTest |
365 |
| - @ValueSource(ints = {SC_BAD_REQUEST, SC_NOT_FOUND, SC_METHOD_NOT_ALLOWED}) |
366 |
| - public void postValidators_WhenNotExisting_ThrowsException(final int responseCode) { |
367 |
| - mockWebServer.enqueue(new MockResponse().setResponseCode(responseCode)); |
| 362 | + @TestTemplate |
| 363 | + public void postValidators_WhenNotExisting_ThrowsException() { |
| 364 | + final List<Integer> responseCodes = |
| 365 | + List.of(SC_BAD_REQUEST, SC_NOT_FOUND, SC_METHOD_NOT_ALLOWED); |
| 366 | + for (int code : responseCodes) { |
| 367 | + checkThrowsExceptionForCode(code); |
| 368 | + } |
| 369 | + } |
368 | 370 |
|
| 371 | + private void checkThrowsExceptionForCode(final int responseCode) { |
| 372 | + mockWebServer.enqueue(new MockResponse().setResponseCode(responseCode)); |
369 | 373 | assertThatThrownBy(() -> okHttpValidatorTypeDefClient.postStateValidators(List.of("1")))
|
370 | 374 | .isInstanceOf(PostStateValidatorsNotExistingException.class);
|
371 | 375 | }
|
|
0 commit comments