Skip to content

Commit

Permalink
other test clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
adamloup-enquizit committed Sep 19, 2024
1 parent 16e0e32 commit d194f64
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,54 @@ public NewPatient withName(final NameDemographic name) {
);
}

public NewPatient withAddress(final Address value) {
return new NewPatient(
administrative(),
birth(),
names(),
Including.include(addresses(), value),
phoneEmails(),
races(),
identifications()
);
}

public NewPatient withPhoneEmail(final Phone value) {
return new NewPatient(
administrative(),
birth(),
names(),
addresses(),
Including.include(phoneEmails(), value),
races(),
identifications()
);
}

public NewPatient withRace(final Race value) {
return new NewPatient(
administrative(),
birth(),
names(),
addresses(),
phoneEmails(),
Including.include(races(), value),
identifications()
);
}

public NewPatient withIdentification(final Identification value) {
return new NewPatient(
administrative(),
birth(),
names(),
addresses(),
phoneEmails(),
races(),
Including.include(identifications(), value)
);
}

public NewPatient withBirth(final BirthDemographic value) {
return new NewPatient(
administrative(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -65,11 +63,8 @@ public void clean() {

@Given("I am adding a new patient with addresses")
public void i_am_adding_a_new_patient_with_addresses() {
NewPatient newPatient = new NewPatient(
null,
null,
Collections.emptyList(),
List.of(
this.input.active(
current -> current.withAddress(
new NewPatient.Address(
RandomUtil.getRandomDateInPast(),
"H",
Expand All @@ -84,19 +79,14 @@ public void i_am_adding_a_new_patient_with_addresses() {
RandomUtil.country(),
RandomUtil.getRandomString()
)
), Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
this.input.active(newPatient);

)
);
}

@Given("I am adding a new patient with emails")
public void i_am_adding_a_new_patient_with_emails() {
NewPatient newPatient = new NewPatient(
null,
null,
Collections.emptyList(),
Collections.emptyList(),
List.of(
this.input.active(
current -> current.withPhoneEmail(
new NewPatient.Phone(
RandomUtil.getRandomDateInPast(),
"type-value",
Expand All @@ -108,21 +98,14 @@ public void i_am_adding_a_new_patient_with_emails() {
"url",
"comment"
)
),
Collections.emptyList(),
Collections.emptyList()
)
);
this.input.active(newPatient);
}

@Given("I am adding a new patient with phones")
public void i_am_adding_a_new_patient_with_phones() {
NewPatient newPatient = new NewPatient(
null,
null,
Collections.emptyList(),
Collections.emptyList(),
List.of(
this.input.active(
current -> current.withPhoneEmail(
new NewPatient.Phone(
RandomUtil.getRandomDateInPast(),
"type-value",
Expand All @@ -134,31 +117,35 @@ public void i_am_adding_a_new_patient_with_phones() {
"url",
"comment"
)
),
Collections.emptyList(),
Collections.emptyList()
)
);
this.input.active(newPatient);

}

@Given("I am adding a new patient with races")
public void i_am_adding_a_new_patient_with_races() {
NewPatient newPatient = new NewPatient(null,null, null, null, null, List.of(new NewPatient.Race(
RandomUtil.getRandomDateInPast(),
"category-value",
Arrays.asList("detail1", "detail2"))), null);
this.input.active(newPatient);
this.input.active(
current -> current.withRace(
new NewPatient.Race(
RandomUtil.getRandomDateInPast(),
"category-value",
Arrays.asList("detail1", "detail2"))
)
);
}

@Given("I am adding a new patient with identifications")
public void i_am_adding_a_new_patient_with_identifications() {
NewPatient newPatient = new NewPatient(null,null, null, null, null, null, List.of(new NewPatient.Identification(
RandomUtil.getRandomDateInPast(),
"DL",
"TX",
"value")));
this.input.active(newPatient);
this.input.active(
current -> current.withIdentification(
new NewPatient.Identification(
RandomUtil.getRandomDateInPast(),
"DL",
"TX",
"value"
)
)
);
}

@When("I send a create patient request")
Expand Down

0 comments on commit d194f64

Please sign in to comment.