@Test public void shouldNotAddPatientToCommunityWhenCommunityIsNotSet() { Community community = mock(Community.class); Patient patient = builder.build(); verify(community, never()).add(patient); }
public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } }
PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } }
PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } PatientBuilder(PersonService personService, MotechService motechService, IdentifierGenerator idGenerator,
                          RegistrantType registrantType, PatientService patientService, LocationService locationService); }
PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } PatientBuilder(PersonService personService, MotechService motechService, IdentifierGenerator idGenerator,
                          RegistrantType registrantType, PatientService patientService, LocationService locationService); PatientBuilder setMotechId(Integer motechId); PatientBuilder setName(String fistName, String middleName, String lastName); PatientBuilder setAddress1(String address1); PatientBuilder setPreferredName(String preferredName); PatientBuilder setGender(Gender gender); PatientBuilder setBirthDate(Date birthDate); PatientBuilder setBirthDateEstimated(boolean birthDateEstimated); PatientBuilder setParent(Patient parent); PatientBuilder addAttribute(PersonAttributeTypeEnum patientAttributeType, Object originalValue, String methodName); PatientBuilder addAttribute(PersonAttributeTypeEnum patientAttributeType, Object originalValue, Object invocationTarget, String methodName); Patient build(); }
PatientBuilder { public Patient build() { if (registrantType == RegistrantType.CHILD_UNDER_FIVE) { return buildChild(); } else { return buildPatient(); } } PatientBuilder(PersonService personService, MotechService motechService, IdentifierGenerator idGenerator,
                          RegistrantType registrantType, PatientService patientService, LocationService locationService); PatientBuilder setMotechId(Integer motechId); PatientBuilder setName(String fistName, String middleName, String lastName); PatientBuilder setAddress1(String address1); PatientBuilder setPreferredName(String preferredName); PatientBuilder setGender(Gender gender); PatientBuilder setBirthDate(Date birthDate); PatientBuilder setBirthDateEstimated(boolean birthDateEstimated); PatientBuilder setParent(Patient parent); PatientBuilder addAttribute(PersonAttributeTypeEnum patientAttributeType, Object originalValue, String methodName); PatientBuilder addAttribute(PersonAttributeTypeEnum patientAttributeType, Object originalValue, Object invocationTarget, String methodName); Patient build();  }