-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CCAP-509] adding additional counties behind enableSDA15Providers flag #1096
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.ilgcc.app.utils; | ||
|
||
import static org.ilgcc.app.utils.CountyOption.CARROLL; | ||
import static org.ilgcc.app.utils.CountyOption.CLAY; | ||
import static org.ilgcc.app.utils.CountyOption.CRAWFORD; | ||
import static org.ilgcc.app.utils.CountyOption.DEKALB; | ||
import static org.ilgcc.app.utils.CountyOption.EDWARDS; | ||
import static org.ilgcc.app.utils.CountyOption.EFFINGHAM; | ||
import static org.ilgcc.app.utils.CountyOption.FAYETTE; | ||
import static org.ilgcc.app.utils.CountyOption.JASPER; | ||
import static org.ilgcc.app.utils.CountyOption.JEFFERSON; | ||
import static org.ilgcc.app.utils.CountyOption.LAWRENCE; | ||
import static org.ilgcc.app.utils.CountyOption.LEE; | ||
import static org.ilgcc.app.utils.CountyOption.MARION; | ||
import static org.ilgcc.app.utils.CountyOption.MCHENRY; | ||
import static org.ilgcc.app.utils.CountyOption.OGLE; | ||
import static org.ilgcc.app.utils.CountyOption.RICHLAND; | ||
import static org.ilgcc.app.utils.CountyOption.WABASH; | ||
import static org.ilgcc.app.utils.CountyOption.WAYNE; | ||
import static org.ilgcc.app.utils.CountyOption.WHITESIDE; | ||
|
||
import jakarta.annotation.PostConstruct; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class CountyOptionUtils { | ||
@Value("${il-gcc.enable-sda15-providers}") | ||
boolean enableSDA15Providers; | ||
|
||
private static List<CountyOption> countyOptions; | ||
|
||
@PostConstruct | ||
public void init() { | ||
countyOptions = new ArrayList<>(); | ||
countyOptions.add(CARROLL); | ||
countyOptions.add(DEKALB); | ||
countyOptions.add(LEE); | ||
countyOptions.add(MCHENRY); | ||
countyOptions.add(OGLE); | ||
countyOptions.add(WHITESIDE); | ||
if (enableSDA15Providers) { | ||
countyOptions.add(MARION); | ||
countyOptions.add(JEFFERSON); | ||
countyOptions.add(EFFINGHAM); | ||
countyOptions.add(FAYETTE); | ||
countyOptions.add(CRAWFORD); | ||
countyOptions.add(WAYNE); | ||
countyOptions.add(RICHLAND); | ||
countyOptions.add(LAWRENCE); | ||
countyOptions.add(CLAY); | ||
countyOptions.add(WABASH); | ||
countyOptions.add(JASPER); | ||
countyOptions.add(EDWARDS); | ||
} | ||
} | ||
|
||
public static List<CountyOption> getActiveCountyOptions() { | ||
return countyOptions; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.ilgcc.app.submission.actions; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import formflow.library.data.FormSubmission; | ||
import formflow.library.data.Submission; | ||
import jakarta.annotation.Resource; | ||
import java.util.Map; | ||
import org.ilgcc.app.IlGCCApplication; | ||
import org.ilgcc.app.utils.CountyOptionUtils; | ||
import org.ilgcc.app.utils.SubmissionTestBuilder; | ||
import org.ilgcc.app.utils.ZipcodeOption; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.util.TestPropertyValues; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @anahar-cfa - you are importing a lot of classes that are not used anywhere on the tests. Can you remove those? Also - If you are testing that the number of active county options is 18 when the flag is on. It would make sense to also confirm that those inactive counties are NOT included when the feature flag is off. |
||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.core.env.Environment; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.DynamicPropertyRegistry; | ||
import org.springframework.test.context.DynamicPropertySource; | ||
import org.springframework.test.context.TestPropertySource; | ||
import org.springframework.test.context.support.TestPropertySourceUtils; | ||
import org.springframework.util.Assert; | ||
|
||
@SpringBootTest( | ||
classes = IlGCCApplication.class | ||
) | ||
|
||
@TestPropertySource(properties = {"il-gcc.enable-sda15-providers=true"}) | ||
@ActiveProfiles("test") | ||
public class CountyUtilTest { | ||
|
||
@Test | ||
public void getCountiesWithSda15ProvidersAsFalse() { | ||
assertThat(CountyOptionUtils.getActiveCountyOptions().size()).isEqualTo(18); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than hard coding this, I think it makes sense to use this logic: