mirror of
https://github.com/google/nomulus.git
synced 2025-05-17 01:47:14 +02: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:
parent
89802329b3
commit
927e8bbd73
7 changed files with 30 additions and 20 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue