-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from codeforamerica/pdf-tca-signature-187366326
Write tca signature only if tca application
- Loading branch information
Showing
4 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
102 changes: 102 additions & 0 deletions
102
src/test/java/org/mdbenefits/app/preparers/ApplicantNeedsPreparerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package org.mdbenefits.app.preparers; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import formflow.library.data.Submission; | ||
import formflow.library.pdf.SingleField; | ||
import formflow.library.pdf.SubmissionField; | ||
import java.time.OffsetDateTime; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.junit.jupiter.api.Test; | ||
import org.mdbenefits.app.data.SubmissionTestBuilder; | ||
import org.mdbenefits.app.testutils.TestUtils; | ||
|
||
class ApplicantNeedsPreparerTest { | ||
private final ApplicantNeedsPreparer preparer = new ApplicantNeedsPreparer(); | ||
|
||
private final OffsetDateTime NovTwelve = TestUtils.makeOffsetDateTime("2024-11-12"); | ||
|
||
@Test | ||
public void tdapProgramSelectionGeneratesNeedsCashAssistance() { | ||
Submission submission = new SubmissionTestBuilder() | ||
.withPersonalInfo("John", "Doe", "10", "12", "1999", | ||
"", "", "", "", "") | ||
.with("programs[]", List.of("TDAP")) | ||
.with("signature", "My Signature") | ||
.build(); | ||
|
||
submission.setSubmittedAt(NovTwelve); | ||
|
||
Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null); | ||
assertThat(result.get("needsSNAP")) | ||
.isEqualTo(new SingleField("needsSNAP", "false", null)); | ||
assertThat(result.get("needsCashAssistance")) | ||
.isEqualTo(new SingleField("needsCashAssistance", "true", null)); | ||
assertThat(result.get("tcaSignature")) | ||
.isEqualTo(new SingleField("tcaSignature", "My Signature", null)); | ||
assertThat(result.get("tcaSubmissionDate")).isEqualTo(new SingleField("tcaSubmissionDate", "11/12/2024", null)); | ||
} | ||
|
||
@Test | ||
public void rcaProgramSelectionGeneratesNeedsCashAssistance() { | ||
Submission submission = new SubmissionTestBuilder() | ||
.withPersonalInfo("John", "Doe", "10", "12", "1999", | ||
"", "", "", "", "") | ||
.with("programs[]", List.of("RCA")) | ||
.with("signature", "My Signature") | ||
.build(); | ||
|
||
submission.setSubmittedAt(NovTwelve); | ||
|
||
Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null); | ||
assertThat(result.get("needsSNAP")) | ||
.isEqualTo(new SingleField("needsSNAP", "false", null)); | ||
assertThat(result.get("needsCashAssistance")) | ||
.isEqualTo(new SingleField("needsCashAssistance", "true", null)); | ||
assertThat(result.get("tcaSignature")) | ||
.isEqualTo(new SingleField("tcaSignature", "My Signature", null)); | ||
assertThat(result.get("tcaSubmissionDate")).isEqualTo(new SingleField("tcaSubmissionDate", "11/12/2024", null)); | ||
} | ||
|
||
@Test | ||
public void snapProgramSelectionGeneratesNeedsCashAssistance() { | ||
Submission submission = new SubmissionTestBuilder() | ||
.withPersonalInfo("John", "Doe", "10", "12", "1999", | ||
"", "", "", "", "") | ||
.with("programs[]", List.of("SNAP")) | ||
.with("signature", "My Signature") | ||
.build(); | ||
|
||
submission.setSubmittedAt(NovTwelve); | ||
|
||
Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null); | ||
assertThat(result.get("needsSNAP")) | ||
.isEqualTo(new SingleField("needsSNAP", "true", null)); | ||
assertThat(result.get("needsCashAssistance")) | ||
.isEqualTo(new SingleField("needsCashAssistance", "false", null)); | ||
assertThat(result.get("tcaSignature")) | ||
.isEqualTo(null); | ||
assertThat(result.get("tcaSubmissionDate")).isEqualTo(null); | ||
} | ||
|
||
@Test | ||
public void tcaProgramSelectionGeneratesNeedsCashAssistance() { | ||
Submission submission = new SubmissionTestBuilder() | ||
.withPersonalInfo("John", "Doe", "10", "12", "1999", | ||
"", "", "", "", "") | ||
.with("programs[]", List.of("TCA")) | ||
.with("signature", "My Signature") | ||
.build(); | ||
|
||
submission.setSubmittedAt(NovTwelve); | ||
|
||
Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null); | ||
assertThat(result.get("needsSNAP")) | ||
.isEqualTo(new SingleField("needsSNAP", "false", null)); | ||
assertThat(result.get("needsCashAssistance")) | ||
.isEqualTo(new SingleField("needsCashAssistance", "true", null)); | ||
assertThat(result.get("tcaSignature")) | ||
.isEqualTo(new SingleField("tcaSignature", "My Signature", null)); | ||
assertThat(result.get("tcaSubmissionDate")).isEqualTo(new SingleField("tcaSubmissionDate", "11/12/2024", null)); | ||
} | ||
} |