mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 17:07:15 +02:00
Merge JUnitBackport's expectThrows into assertThrows
More information: https://github.com/junit-team/junit5/issues/531 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187034408
This commit is contained in:
parent
f96a0b7da9
commit
606b470cd0
180 changed files with 1325 additions and 1381 deletions
|
@ -23,7 +23,7 @@ import static google.registry.request.RequestParameters.extractOptionalEnumParam
|
|||
import static google.registry.request.RequestParameters.extractOptionalParameter;
|
||||
import static google.registry.request.RequestParameters.extractRequiredDatetimeParameter;
|
||||
import static google.registry.request.RequestParameters.extractRequiredParameter;
|
||||
import static google.registry.testing.JUnitBackports.expectThrows;
|
||||
import static google.registry.testing.JUnitBackports.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class RequestParametersTest {
|
|||
@Test
|
||||
public void testExtractRequiredParameter_notPresent_throwsBadRequest() throws Exception {
|
||||
BadRequestException thrown =
|
||||
expectThrows(BadRequestException.class, () -> extractRequiredParameter(req, "spin"));
|
||||
assertThrows(BadRequestException.class, () -> extractRequiredParameter(req, "spin"));
|
||||
assertThat(thrown).hasMessageThat().contains("spin");
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class RequestParametersTest {
|
|||
public void testExtractRequiredParameter_empty_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("spin")).thenReturn("");
|
||||
BadRequestException thrown =
|
||||
expectThrows(BadRequestException.class, () -> extractRequiredParameter(req, "spin"));
|
||||
assertThrows(BadRequestException.class, () -> extractRequiredParameter(req, "spin"));
|
||||
assertThat(thrown).hasMessageThat().contains("spin");
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class RequestParametersTest {
|
|||
public void testExtractEnumValue_nonExistentValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("spin")).thenReturn("sing");
|
||||
BadRequestException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadRequestException.class, () -> extractEnumParameter(req, Club.class, "spin"));
|
||||
assertThat(thrown).hasMessageThat().contains("spin");
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class RequestParametersTest {
|
|||
public void testOptionalExtractEnumValue_nonExistentValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("spin")).thenReturn("sing");
|
||||
BadRequestException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadRequestException.class, () -> extractOptionalEnumParameter(req, Club.class, "spin"));
|
||||
assertThat(thrown).hasMessageThat().contains("spin");
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class RequestParametersTest {
|
|||
public void testExtractRequiredDatetimeParameter_badValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("timeParam")).thenReturn("Tuesday at three o'clock");
|
||||
BadRequestException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadRequestException.class, () -> extractRequiredDatetimeParameter(req, "timeParam"));
|
||||
assertThat(thrown).hasMessageThat().contains("timeParam");
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public class RequestParametersTest {
|
|||
public void testExtractOptionalDatetimeParameter_badValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("timeParam")).thenReturn("Tuesday at three o'clock");
|
||||
BadRequestException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadRequestException.class, () -> extractOptionalDatetimeParameter(req, "timeParam"));
|
||||
assertThat(thrown).hasMessageThat().contains("timeParam");
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ public class RequestParametersTest {
|
|||
@Test
|
||||
public void testExtractRequiredDatetimeParameter_noValue_throwsBadRequest() throws Exception {
|
||||
BadRequestException thrown =
|
||||
expectThrows(
|
||||
assertThrows(
|
||||
BadRequestException.class, () -> extractRequiredDatetimeParameter(req, "timeParam"));
|
||||
assertThat(thrown).hasMessageThat().contains("timeParam");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue