-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31c86ec
commit 16e0e32
Showing
15 changed files
with
683 additions
and
81 deletions.
There are no files selected for viewing
132 changes: 132 additions & 0 deletions
132
apps/modernization-api/src/main/java/gov/cdc/nbs/patient/profile/birth/BirthDemographic.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,132 @@ | ||
package gov.cdc.nbs.patient.profile.birth; | ||
|
||
import java.time.LocalDate; | ||
|
||
public record BirthDemographic( | ||
LocalDate asOf, | ||
LocalDate bornOn, | ||
String sex, | ||
String multiple, | ||
Integer order, | ||
String city, | ||
String state, | ||
String county, | ||
String country | ||
) { | ||
|
||
BirthDemographic(final LocalDate asOf) { | ||
this(asOf, null, null, null, null, null, null, null, null); | ||
} | ||
|
||
BirthDemographic withBornOn(final LocalDate value) { | ||
return new BirthDemographic( | ||
asOf(), | ||
value, | ||
sex(), | ||
multiple(), | ||
order(), | ||
city(), | ||
state(), | ||
county(), | ||
country() | ||
); | ||
} | ||
|
||
BirthDemographic withSex(final String value) { | ||
return new BirthDemographic( | ||
asOf(), | ||
bornOn(), | ||
value, | ||
multiple(), | ||
order(), | ||
city(), | ||
state(), | ||
county(), | ||
country() | ||
); | ||
} | ||
|
||
BirthDemographic withMultiple(final String value) { | ||
return new BirthDemographic( | ||
asOf(), | ||
bornOn(), | ||
sex(), | ||
value, | ||
order(), | ||
city(), | ||
state(), | ||
county(), | ||
country() | ||
); | ||
} | ||
|
||
BirthDemographic withOrder(final int value) { | ||
return new BirthDemographic( | ||
asOf(), | ||
bornOn(), | ||
sex(), | ||
multiple(), | ||
value, | ||
city(), | ||
state(), | ||
county(), | ||
country() | ||
); | ||
} | ||
|
||
BirthDemographic withCity(final String value) { | ||
return new BirthDemographic( | ||
asOf(), | ||
bornOn(), | ||
sex(), | ||
multiple(), | ||
order(), | ||
value, | ||
state(), | ||
county(), | ||
country() | ||
); | ||
} | ||
|
||
BirthDemographic withCounty(final String value) { | ||
return new BirthDemographic( | ||
asOf(), | ||
bornOn(), | ||
sex(), | ||
multiple(), | ||
order(), | ||
city(), | ||
state(), | ||
value, | ||
country() | ||
); | ||
} | ||
|
||
BirthDemographic withState(final String value) { | ||
return new BirthDemographic( | ||
asOf(), | ||
bornOn(), | ||
sex(), | ||
multiple(), | ||
order(), | ||
city(), | ||
value, | ||
county(), | ||
country() | ||
); | ||
} | ||
|
||
BirthDemographic withCountry(final String value) { | ||
return new BirthDemographic( | ||
asOf(), | ||
bornOn(), | ||
sex(), | ||
multiple(), | ||
order(), | ||
city(), | ||
state(), | ||
county(), | ||
value | ||
); | ||
} | ||
} |
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
60 changes: 60 additions & 0 deletions
60
...ation-api/src/test/java/gov/cdc/nbs/patient/profile/birth/BirthDemographicEntrySteps.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,60 @@ | ||
package gov.cdc.nbs.patient.profile.birth; | ||
|
||
import gov.cdc.nbs.testing.support.Active; | ||
import io.cucumber.java.en.Given; | ||
|
||
import java.time.LocalDate; | ||
|
||
public class BirthDemographicEntrySteps { | ||
|
||
private final Active<BirthDemographic> input; | ||
|
||
BirthDemographicEntrySteps(final Active<BirthDemographic> input) { | ||
this.input = input; | ||
} | ||
|
||
@Given("I enter the birth demographics as of date {localDate}") | ||
public void i_enter_patient_birth_as_of(final LocalDate value) { | ||
this.input.active(new BirthDemographic(value)); | ||
} | ||
|
||
@Given("I enter the birth demographics with the patient born on {localDate}") | ||
public void i_enter_patient_birth_born_on(final LocalDate value) { | ||
this.input.active(current -> current.withBornOn(value)); | ||
} | ||
|
||
@Given("I enter the birth demographics with the patient born as {sex}") | ||
public void i_enter_patient_birth_born_as(final String value) { | ||
this.input.active(current -> current.withSex(value)); | ||
} | ||
|
||
@Given("I enter the birth demographics with the patient multiple as {indicator}") | ||
public void i_enter_patient_birth_multiple_as(final String value) { | ||
this.input.active(current -> current.withMultiple(value)); | ||
} | ||
|
||
@Given("I enter the birth demographics with the patient born {nth}") | ||
public void i_enter_patient_birth_multiple_as(final int value) { | ||
this.input.active(current -> current.withOrder(value)); | ||
} | ||
|
||
@Given("I enter the birth demographics with the patient born in the city {string}") | ||
public void i_enter_patient_birth_city_as(final String value) { | ||
this.input.active(current -> current.withCity(value)); | ||
} | ||
|
||
@Given("I enter the birth demographics with the patient born in the county {county}") | ||
public void i_enter_patient_birth_county_as(final String value) { | ||
this.input.active(current -> current.withCounty(value)); | ||
} | ||
|
||
@Given("I enter the birth demographics with the patient born in the state {state}") | ||
public void i_enter_patient_birth_state_as(final String value) { | ||
this.input.active(current -> current.withState(value)); | ||
} | ||
|
||
@Given("I enter the birth demographics with the patient born in the country {county}") | ||
public void i_enter_patient_birth_country_as(final String value) { | ||
this.input.active(current -> current.withCountry(value)); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...src/test/java/gov/cdc/nbs/patient/profile/birth/BirthDemographicSupportConfiguration.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,19 @@ | ||
package gov.cdc.nbs.patient.profile.birth; | ||
|
||
import gov.cdc.nbs.testing.support.Active; | ||
import io.cucumber.spring.ScenarioScope; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.time.Clock; | ||
import java.time.LocalDate; | ||
|
||
@Configuration | ||
class BirthDemographicSupportConfiguration { | ||
|
||
@Bean | ||
@ScenarioScope | ||
Active<BirthDemographic> activeBirthDemographic(final Clock clock) { | ||
return new Active<>(() -> new BirthDemographic(LocalDate.now(clock))); | ||
} | ||
} |
Oops, something went wrong.