diff --git a/src/main/java/se/sunet/navet/service/api/NavetNotification.java b/src/main/java/se/sunet/navet/service/api/NavetNotification.java index b0c1d2d..bc34f3e 100644 --- a/src/main/java/se/sunet/navet/service/api/NavetNotification.java +++ b/src/main/java/se/sunet/navet/service/api/NavetNotification.java @@ -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 @@ -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 notificationNameElement = name.getAviseringsnamn(); + if (notificationNameElement != null) { + this.setNotificationName(notificationNameElement.getValue()); + } } public String getGivenNameMarking() { @@ -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 { diff --git a/src/test/java/se/sunet/navet/service/api/NavetNotificationTest.java b/src/test/java/se/sunet/navet/service/api/NavetNotificationTest.java index 9084c32..c36801a 100644 --- a/src/test/java/se/sunet/navet/service/api/NavetNotificationTest.java +++ b/src/test/java/se/sunet/navet/service/api/NavetNotificationTest.java @@ -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 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()); + } } diff --git a/src/test/java/se/sunet/navet/service/api/SetupCommon.java b/src/test/java/se/sunet/navet/service/api/SetupCommon.java index 8ad9f82..7ab958e 100644 --- a/src/test/java/se/sunet/navet/service/api/SetupCommon.java +++ b/src/test/java/se/sunet/navet/service/api/SetupCommon.java @@ -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 {