Skip to content

Commit

Permalink
add NotificationName to Name
Browse files Browse the repository at this point in the history
  • Loading branch information
helylle committed Sep 20, 2023
1 parent 3220b9e commit 7d1f5f3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main/java/se/sunet/navet/service/api/NavetNotification.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ public static class Name {
private String GivenName;
private String MiddleName;
private String Surname;
private String NotificationName;

public void setAll(NamnTYPE name) {
// GivenNameMarking
Expand All @@ -246,7 +247,12 @@ public void setAll(NamnTYPE name) {
if (surNameElement != null) {
this.setSurname(surNameElement.getValue());
}

// NotificationName
// created by SKV to be maximum 36 characters long
JAXBElement<String> notificationNameElement = name.getAviseringsnamn();
if (notificationNameElement != null) {
this.setNotificationName(notificationNameElement.getValue());
}
}

public String getGivenNameMarking() {
Expand Down Expand Up @@ -280,6 +286,14 @@ public String getSurname() {
public void setSurname(String surname) {
Surname = surname;
}

public String getNotificationName() {
return NotificationName;
}

public void setNotificationName(String notificationName) {
NotificationName = notificationName;
}
}

public static class PostalAddresses {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,25 @@ public void testNINSkyddMatch() throws Exception {
assertEquals(jsonResponse.getPopulationItems().get(0).getSecrecyMark(), "J");
assertEquals(jsonResponse.getPopulationItems().get(0).ProtectedPopulationRegistration(), "J");
}

@Test
public void testNINNotificationName() throws Exception {
Server server = embeddedServer.getServer();
String servletPath = "/personpost/navetnotification";

Client client = ClientBuilder.newClient();
WebTarget target = client.target(server.getURI()).path(servletPath);

HashMap<String, String> data = new HashMap<>();
data.put("identity_number", TEST_PERSON_NOTIFICATIONNAME_NIN);

Entity entity = Entity.entity(gson.toJson(data), MediaType.APPLICATION_JSON);
Response response = target.request(MediaType.APPLICATION_JSON).post(entity);

NavetNotification.Response jsonResponse = gson.fromJson(response.readEntity(String.class), NavetNotification.Response.class);

assertNotNull(jsonResponse.getPopulationItems().get(0).getPersonItem());
assertNotNull(jsonResponse.getPopulationItems().get(0).getPersonItem().getName());
assertNotNull(jsonResponse.getPopulationItems().get(0).getPersonItem().getName().getNotificationName());
}
}
1 change: 1 addition & 0 deletions src/test/java/se/sunet/navet/service/api/SetupCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class SetupCommon {
public static final String TEST_PERSON_GIVEN_NAME = "Teofil";
public static final String TEST_PERSON_FAILING_GIVEN_NAME = "Mupp";
public static final String TEST_PERSON_DEREGISTERED_NIN = "195003072260";
public static final String TEST_PERSON_NOTIFICATIONNAME_NIN = "194107086995";

@BeforeClass
public void setUp() throws Exception {
Expand Down

0 comments on commit 7d1f5f3

Please sign in to comment.