clicked then user input should be validated`() { whenever(patientRepository.ongoingEntry()).thenReturn(Single.just(OngoingNewPatientEntry())) with(uiEvents) { onNext(FullNameChanged("")) onNext(PhoneNumberChanged("")) onNext(DateOfBirthChanged("")) onNext(AgeChanged("")) onNext(GenderChanged(None)) onNext(ColonyOrVillageChanged("")) onNext(DistrictChanged("")) onNext(StateChanged("")) onNext(SaveClicked) } with(uiEvents) { onNext(DateOfBirthChanged("33/33/3333")) onNext(SaveClicked) } with(uiEvents) { onNext(AgeChanged(" ")) onNext(DateOfBirthChanged("")) onNext(SaveClicked) } with(uiEvents) { onNext(DateOfBirthChanged("16/07/2018")) onNext(SaveClicked) } with(uiEvents) { onNext(PhoneNumberChanged("1234")) onNext(SaveClicked) } with(uiEvents) { onNext(PhoneNumberChanged("1234567890987654")) onNext(SaveClicked) } verify(ui, atLeastOnce()).showEmptyFullNameError(true) verify(ui, atLeastOnce()).showEmptyDateOfBirthAndAgeError(true) verify(ui, atLeastOnce()).showInvalidDateOfBirthError(true) verify(ui, atLeastOnce()).showMissingGenderError(true) verify(ui, atLeastOnce()).showEmptyColonyOrVillageError(true) verify(ui, atLeastOnce()).showEmptyDistrictError(true) verify(ui, atLeastOnce()).showEmptyStateError(true) verify(ui, atLeastOnce()).showLengthTooShortPhoneNumberError(true) verify(ui, atLeastOnce()).showLengthTooLongPhoneNumberError(true) }