Skip to content
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

AFHS-2008 - made nino as optional field in PersonDTO #84

Merged
merged 2 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class PersonDTO {
@JsonProperty("surname")
private final String surname;

@NotNull
@Pattern(regexp = "^(?!BG|GB|NK|KN|TN|NT|ZZ)[A-CEGHJ-PR-TW-Z][A-CEGHJ-NPR-TW-Z](\\d{6})[A-D]$")
@JsonProperty("nino")
private final String nino;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.dhsc.htbhf.dwp.model;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -35,13 +36,21 @@ void shouldFailValidationWithMissingSurname() {
assertThat(violations).hasSingleConstraintViolation("must not be null", "surname");
}

@Disabled("nino is optional for private beta and unique key is yet to be decided")
@Test
void shouldFailValidationWithMissingNino() {
PersonDTO personDTO = aPersonDTOWithNino(null);
Set<ConstraintViolation<PersonDTO>> violations = validator.validate(personDTO);
assertThat(violations).hasSingleConstraintViolation("must not be null", "nino");
}

@Test
void shouldValidationWithMissingNino() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to 'shouldValidateWithMissingNino'

PersonDTO personDTO = aPersonDTOWithNino(null);
Set<ConstraintViolation<PersonDTO>> violations = validator.validate(personDTO);
assertThat(violations).hasNoViolations();
}

@ParameterizedTest
@ValueSource(strings = {
"",
Expand Down