mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +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
|
@ -61,6 +61,7 @@ public class Spec11EmailUtilsTest {
|
|||
private Spec11EmailUtils emailUtils;
|
||||
private Spec11RegistrarThreatMatchesParser parser;
|
||||
private ArgumentCaptor<Message> gotMessage;
|
||||
private final LocalDate date = new LocalDate(2018, 7, 15);
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
@ -69,7 +70,6 @@ public class Spec11EmailUtilsTest {
|
|||
.thenAnswer((args) -> new MimeMessage(Session.getInstance(new Properties(), null)));
|
||||
|
||||
parser = mock(Spec11RegistrarThreatMatchesParser.class);
|
||||
LocalDate date = new LocalDate(2018, 7, 15);
|
||||
when(parser.getRegistrarThreatMatches(date)).thenReturn(sampleThreatMatches());
|
||||
|
||||
gotMessage = ArgumentCaptor.forClass(Message.class);
|
||||
|
@ -77,7 +77,6 @@ public class Spec11EmailUtilsTest {
|
|||
emailUtils =
|
||||
new Spec11EmailUtils(
|
||||
emailService,
|
||||
date,
|
||||
"my-sender@test.com",
|
||||
"my-receiver@test.com",
|
||||
"my-reply-to@test.com",
|
||||
|
@ -89,6 +88,7 @@ public class Spec11EmailUtilsTest {
|
|||
@Test
|
||||
public void testSuccess_emailMonthlySpec11Reports() throws Exception {
|
||||
emailUtils.emailSpec11Reports(
|
||||
date,
|
||||
Spec11EmailSoyInfo.MONTHLY_SPEC_11_EMAIL,
|
||||
"Super Cool Registry Monthly Threat Detector [2018-07-15]",
|
||||
sampleThreatMatches());
|
||||
|
@ -143,6 +143,7 @@ public class Spec11EmailUtilsTest {
|
|||
@Test
|
||||
public void testSuccess_emailDailySpec11Reports() throws Exception {
|
||||
emailUtils.emailSpec11Reports(
|
||||
date,
|
||||
Spec11EmailSoyInfo.DAILY_SPEC_11_EMAIL,
|
||||
"Super Cool Registry Daily Threat Detector [2018-07-15]",
|
||||
sampleThreatMatches());
|
||||
|
@ -224,7 +225,7 @@ public class Spec11EmailUtilsTest {
|
|||
RuntimeException.class,
|
||||
() ->
|
||||
emailUtils.emailSpec11Reports(
|
||||
Spec11EmailSoyInfo.MONTHLY_SPEC_11_EMAIL, "bar", sampleThreatMatches()));
|
||||
date, Spec11EmailSoyInfo.MONTHLY_SPEC_11_EMAIL, "bar", sampleThreatMatches()));
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("Emailing spec11 report failed");
|
||||
assertThat(thrown)
|
||||
.hasCauseThat()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue