Skip to content

Commit

Permalink
Change Counties to County - general cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bseeger committed May 20, 2024
1 parent 1c72c13 commit ed821f3
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import lombok.extern.slf4j.Slf4j;
import org.mdbenefits.app.data.Transmission;
import org.mdbenefits.app.data.TransmissionRepository;
import org.mdbenefits.app.data.enums.Counties;
import org.mdbenefits.app.data.enums.County;
import org.mdbenefits.app.data.enums.TransmissionStatus;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
Expand Down Expand Up @@ -324,7 +324,7 @@ private String getUserFileName(String confirmationNumber, UserFile file, int num
* @return String containing the Google Drive ID.
*/
private String getCountyFolderId(String county) {
return county.equals(Counties.BALTIMORE.name()) ? BALTIMORE_COUNTY_GOOGLE_DIR_ID : QUEEN_ANNES_COUNTY_GOOGLE_DIR_ID;
return county.equals(County.BALTIMORE.name()) ? BALTIMORE_COUNTY_GOOGLE_DIR_ID : QUEEN_ANNES_COUNTY_GOOGLE_DIR_ID;
}

/**
Expand All @@ -334,6 +334,6 @@ private String getCountyFolderId(String county) {
* @return
*/
private String getCountyEmailRecipients(String county) {
return county.equals(Counties.BALTIMORE.name()) ? BALITMORE_COUNTY_EMAIL_RECIPIENTS : QUEEN_ANNES_COUNTY_EMAIL_RECIPIENTS;
return county.equals(County.BALTIMORE.name()) ? BALITMORE_COUNTY_EMAIL_RECIPIENTS : QUEEN_ANNES_COUNTY_EMAIL_RECIPIENTS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
import lombok.Getter;

@Getter
public enum Counties {
public enum County {

BALTIMORE("county.option.baltimore_county", true),
QUEEN_ANNES("county.option.queenannes_county", true),
OTHER("county.option.other", false);

static private final Map<String, Counties> MAP_BY_ENUM_NAME = new HashMap<>();
static private final Map<String, County> MAP_BY_ENUM_NAME = new HashMap<>();

static {
for (Counties county : Counties.values()) {
for (County county : County.values()) {
MAP_BY_ENUM_NAME.put(county.name(), county);
}
}

private final String labelSrc;
private final boolean inPilot;

Counties(String labelSrc, boolean inPilot) {
County(String labelSrc, boolean inPilot) {
this.labelSrc = labelSrc;
this.inPilot = inPilot;
}

public static Counties getCountyByName(String name) {
public static County getCountyByName(String name) {
return MAP_BY_ENUM_NAME.get(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.List;
import java.util.Map;
import org.mdbenefits.app.data.enums.ApplicantObjective;
import org.mdbenefits.app.data.enums.Counties;
import org.mdbenefits.app.data.enums.County;
import org.springframework.stereotype.Component;

/**
Expand All @@ -31,7 +31,7 @@ public Boolean run(Submission submission) {
List<String> applicationInfoList =
(List<String>) inputData.getOrDefault("applicationInfo[]", new ArrayList<String>());

return (!county.isBlank() && !Counties.getCountyByName(county).isInPilot()) ||
return (!county.isBlank() && !County.getCountyByName(county).isInPilot()) ||
(!applicationInfoList.isEmpty() && !applicationInfoList.contains(ApplicantObjective.OTHER.name())) ||
(inputData.getOrDefault("needsToReCertify", "false")
.toString().equalsIgnoreCase("true"));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/mdBenefitsFlow/county.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<th:block
th:replace="~{fragments/inputs/selectOptionPlaceholder :: selectOptionPlaceholder(optionText=#{county.select})}"/>
<th:block
th:each="countyEnum : ${T(org.mdbenefits.app.data.enums.Counties).values()}">
th:each="countyEnum : ${T(org.mdbenefits.app.data.enums.County).values()}">
<th:block
th:replace="~{fragments/inputs/selectOption :: selectOption(
value=${countyEnum.name()},
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/templates/mdBenefitsFlow/howThisWorks.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
buttonLabel=#{how-this-works.add-documents},
content=~{::add-documents})}">
<th:block th:ref="add-documents"
th:with="email=${inputData.county == T(org.mdbenefits.app.data.enums.Counties).BALTIMORE.name() ?
th:with="email=${inputData.county == T(org.mdbenefits.app.data.enums.County).BALTIMORE.name() ?
'<a href=&quot;mailto:baltimorecounty.dmc@maryland.gov&quot; target=&quot;_blank&quot;>baltimorecounty.dmc@maryland.gov</a>' :
(inputData.county == T(org.mdbenefits.app.data.enums.Counties).QUEEN_ANNES.name() ?
(inputData.county == T(org.mdbenefits.app.data.enums.County).QUEEN_ANNES.name() ?
'<a href=&quot;mailto:qacfia.customeraccount@maryland.gov&quot; target=&quot;_blank&quot;>qacfia.customeraccount@maryland.gov</a>' : null)}">
<p th:text="#{how-this-works.add-documents-l1}"></p>
<p th:utext="#{how-this-works.add-documents-l2}"></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.mdbenefits.app.data.SubmissionTestBuilder;
import org.mdbenefits.app.data.Transmission;
import org.mdbenefits.app.data.TransmissionRepository;
import org.mdbenefits.app.data.enums.Counties;
import org.mdbenefits.app.data.enums.County;
import org.mdbenefits.app.data.enums.ProgramType;
import org.mdbenefits.app.data.enums.RaceType;
import org.mdbenefits.app.data.enums.TransmissionStatus;
Expand Down Expand Up @@ -86,7 +86,7 @@ void setup() {
.withHouseholdMemberApplying("Betty", "White", "10", "2", "1999",
"Child", "F", "NeverMarried", "firstGrade", "123456789",
"Yes", "Yes", List.of(RaceType.ASIAN.name()), EthnicityType.NOT_HISPANIC_OR_LATINO.name())
.with("county", Counties.BALTIMORE.name())
.with("county", County.BALTIMORE.name())
.build()
);

Expand All @@ -97,7 +97,7 @@ void setup() {
.withHouseholdMemberApplying("Betty", "Red", "10", "2", "1999",
"Child", "F", "NeverMarried", "firstGrade", "123456789",
"Yes", "Yes", List.of(RaceType.ASIAN.name()), EthnicityType.NOT_HISPANIC_OR_LATINO.name())
.with("county", Counties.BALTIMORE.name())
.with("county", County.BALTIMORE.name())
.build()
);

Expand All @@ -108,7 +108,7 @@ void setup() {
.withHouseholdMemberApplying("Malcolm", "Tester", "10", "2", "1999",
"Child", "F", "NeverMarried", "firstGrade", "123456789",
"Yes", "Yes", List.of(RaceType.ASIAN.name()), EthnicityType.NOT_HISPANIC_OR_LATINO.name())
.with("county", Counties.BALTIMORE.name())
.with("county", County.BALTIMORE.name())
.build()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.mdbenefits.app.data.enums.ApplicantObjective;
import org.mdbenefits.app.data.enums.Counties;
import org.mdbenefits.app.data.enums.County;
import org.mdbenefits.app.data.enums.EthnicityType;
import org.mdbenefits.app.testutils.AbstractBasePageTest;
import org.openqa.selenium.By;
Expand Down Expand Up @@ -55,13 +55,13 @@ void redirectToMyMDTHINKOnUnsupportedApplicationType() {
void redirectToMyMDTHINKOnUnsupportedCounty() {
testPage.navigateToFlowScreen("mdBenefitsFlow/county");
// should redirect to MyMDTHINK
testPage.selectFromDropdown("county", message(Counties.OTHER.getLabelSrc()));
testPage.selectFromDropdown("county", message(County.OTHER.getLabelSrc()));
testPage.clickContinue();
assertThat(testPage.getTitle()).isEqualTo(message("redirect.mdthink.title"));

// should not redirect
testPage.navigateToFlowScreen("mdBenefitsFlow/county");
testPage.selectFromDropdown("county", message(Counties.BALTIMORE.getLabelSrc()));
testPage.selectFromDropdown("county", message(County.BALTIMORE.getLabelSrc()));
testPage.clickContinue();
assertThat(testPage.getTitle()).isEqualTo(message("offboarding-information.title"));
}
Expand Down Expand Up @@ -164,7 +164,7 @@ void incomeFlow() {

@Test
void testEmailAddresses() {
preloadCountyScreen(message(Counties.BALTIMORE.getLabelSrc()));
preloadCountyScreen(message(County.BALTIMORE.getLabelSrc()));
loadUserPersonalData();
loadAddressData();
testPage.navigateToFlowScreen("mdBenefitsFlow/contactInfo");
Expand Down Expand Up @@ -381,7 +381,7 @@ void completeFlowApplicantOnly() {
testPage.clickButton("Apply Now");
assertThat(testPage.getTitle()).isEqualTo("County");

testPage.selectFromDropdown("county", message(Counties.BALTIMORE.getLabelSrc()));
testPage.selectFromDropdown("county", message(County.BALTIMORE.getLabelSrc()));
testPage.clickContinue();

assertThat(testPage.getTitle()).isEqualTo(message("offboarding-information.title"));
Expand Down Expand Up @@ -807,11 +807,11 @@ void shouldEditMailingAddressWhenNoHomeAddressAndEditRequested() throws SmartyEx

@Test
void howThisWorksShouldShowCorrectEmailForCounty() {
preloadCountyScreen(message(Counties.BALTIMORE.getLabelSrc()));
preloadCountyScreen(message(County.BALTIMORE.getLabelSrc()));
testPage.navigateToFlowScreen("mdBenefitsFlow/howThisWorks");
testPage.findAccordionByButtonText("How to add documents").click();
assertThat(testPage.findElementById("county-document-email").getText()).contains("baltimorecounty.dmc@maryland.gov");
preloadCountyScreen(message(Counties.QUEEN_ANNES.getLabelSrc()));
preloadCountyScreen(message(County.QUEEN_ANNES.getLabelSrc()));
testPage.navigateToFlowScreen("mdBenefitsFlow/howThisWorks");
testPage.findAccordionByButtonText("How to add documents").click();
assertThat(testPage.findElementById("county-document-email").getText()).contains("qacfia.customeraccount@maryland.gov");
Expand Down Expand Up @@ -840,7 +840,7 @@ void confirmationPageWithFeedback() {

@Test
void confirmationPageShouldShowEmailMsg() {
preloadCountyScreen(message(Counties.BALTIMORE.getLabelSrc()));
preloadCountyScreen(message(County.BALTIMORE.getLabelSrc()));
loadUserPersonalData();
loadAddressData();
loadContactData(true);
Expand All @@ -856,7 +856,7 @@ void confirmationPageShouldShowEmailMsg() {

@Test
void confirmationPageShouldNotShowEmailMsg() {
preloadCountyScreen(message(Counties.BALTIMORE.getLabelSrc()));
preloadCountyScreen(message(County.BALTIMORE.getLabelSrc()));
loadUserPersonalData();
loadAddressData();
loadContactData(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.mdbenefits.app.data.SubmissionTestBuilder;
import org.mdbenefits.app.data.Transmission;
import org.mdbenefits.app.data.TransmissionRepository;
import org.mdbenefits.app.data.enums.Counties;
import org.mdbenefits.app.data.enums.County;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mockito;
Expand Down Expand Up @@ -123,7 +123,7 @@ public void shouldRecordFailedSend() {
private Submission buildValidSubmission() {
Submission submission = new SubmissionTestBuilder()
.with("emailAddress", "foo@example.com")
.with("county", Counties.QUEEN_ANNES.name())
.with("county", County.QUEEN_ANNES.name())
.build();
submission.setFlow("mdBenefitsFlow");
return submission;
Expand Down

0 comments on commit ed821f3

Please sign in to comment.