Skip to content

Commit 781a584

Browse files
committed
Fix test
1 parent e8deebb commit 781a584

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

validator/remote/src/integration-test/java/tech/pegasys/teku/validator/remote/typedef/OkHttpValidatorTypeDefClientTest.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
import org.junit.jupiter.api.Assertions;
3737
import org.junit.jupiter.api.BeforeEach;
3838
import org.junit.jupiter.api.TestTemplate;
39-
import org.junit.jupiter.params.ParameterizedTest;
40-
import org.junit.jupiter.params.provider.ValueSource;
4139
import tech.pegasys.teku.api.exceptions.RemoteServiceNotAvailableException;
4240
import tech.pegasys.teku.api.response.v1.beacon.ValidatorStatus;
4341
import tech.pegasys.teku.ethereum.json.types.beacon.StateValidatorData;
@@ -361,11 +359,17 @@ public void postValidators_WhenNoContent_ReturnsEmpty() {
361359
assertThat(okHttpValidatorTypeDefClient.postStateValidators(List.of("1"))).isEmpty();
362360
}
363361

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+
}
368370

371+
private void checkThrowsExceptionForCode(final int responseCode) {
372+
mockWebServer.enqueue(new MockResponse().setResponseCode(responseCode));
369373
assertThatThrownBy(() -> okHttpValidatorTypeDefClient.postStateValidators(List.of("1")))
370374
.isInstanceOf(PostStateValidatorsNotExistingException.class);
371375
}

0 commit comments

Comments
 (0)