mirror of
https://github.com/google/nomulus
synced 2026-02-09 22:40:55 +00:00
Move LocalDate injection to the Actions themselves
We want to make it clear what query (or POST) inputs the user needs to / can give for each Action. That means moving all the @Injects of these parameters to the Actions themselves instead of injecting them in "hidden" indirect dependencies. This has the extra benefit of allowing these indirect dependencies to work for JSON Actions as well, since the "regular" way we @Inject parameters can corrupt the POST JSON data. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=232540758
This commit is contained in:
@@ -108,13 +108,13 @@ public class ReportingModuleTest {
|
||||
|
||||
@Test
|
||||
public void testEmptyDate_returnsToday() {
|
||||
assertThat(ReportingModule.provideDate(Optional.empty(), clock))
|
||||
.isEqualTo(new LocalDate(2017, 7, 1));
|
||||
when(req.getParameter("date")).thenReturn(null);
|
||||
assertThat(ReportingModule.provideDate(req, clock)).isEqualTo(new LocalDate(2017, 7, 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGivenDate_returnsThatDate() {
|
||||
assertThat(ReportingModule.provideDate(Optional.of(new LocalDate(2017, 7, 2)), clock))
|
||||
.isEqualTo(new LocalDate(2017, 7, 2));
|
||||
when(req.getParameter("date")).thenReturn("2017-07-02");
|
||||
assertThat(ReportingModule.provideDate(req, clock)).isEqualTo(new LocalDate(2017, 7, 2));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user