mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 17:07:15 +02:00
Add MR to expand billing events into OneTimes
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=124837292
This commit is contained in:
parent
7cf4ddce97
commit
2a83d122ef
6 changed files with 69 additions and 8 deletions
|
@ -17,6 +17,7 @@ package google.registry.request;
|
|||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.request.RequestParameters.extractBooleanParameter;
|
||||
import static google.registry.request.RequestParameters.extractEnumParameter;
|
||||
import static google.registry.request.RequestParameters.extractOptionalDatetimeParameter;
|
||||
import static google.registry.request.RequestParameters.extractOptionalParameter;
|
||||
import static google.registry.request.RequestParameters.extractRequiredDatetimeParameter;
|
||||
import static google.registry.request.RequestParameters.extractRequiredMaybeEmptyParameter;
|
||||
|
@ -184,6 +185,26 @@ public class RequestParametersTest {
|
|||
extractRequiredDatetimeParameter(req, "timeParam");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractOptionalDatetimeParameter_correctValue_works() throws Exception {
|
||||
when(req.getParameter("timeParam")).thenReturn("2015-08-27T13:25:34.123Z");
|
||||
assertThat(extractOptionalDatetimeParameter(req, "timeParam"))
|
||||
.hasValue(DateTime.parse("2015-08-27T13:25:34.123Z"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractOptionalDatetimeParameter_badValue_throwsBadRequest() throws Exception {
|
||||
when(req.getParameter("timeParam")).thenReturn("Tuesday at three o'clock");
|
||||
thrown.expect(BadRequestException.class, "timeParam");
|
||||
extractOptionalDatetimeParameter(req, "timeParam");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractOptionalDatetimeParameter_empty_returnsAbsent() throws Exception {
|
||||
when(req.getParameter("timeParam")).thenReturn("");
|
||||
assertThat(extractOptionalDatetimeParameter(req, "timeParam")).isAbsent();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractRequiredDatetimeParameter_noValue_throwsBadRequest() throws Exception {
|
||||
thrown.expect(BadRequestException.class, "timeParam");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue