Commits

Thomas Klemmensen authored and Jeppe Borup Larsen committed 81ff077bef5 Merge
Pull request #9: SDS-7362 Fejlrettelse af cpr statuskoder i personinformation er integers

Merge in COM/stamdatamodul from SDS-7362-cpr-statuskoder-i-personinformation-er-integers to release/SDS-6876-bugfix * commit 'a9a7d1702ba23cc0874eb4cad582f2133b7e8b99': SDS-7362: Rettet så ny version af Status returnere StatusCode objekt. Lavet så andre snitflader findes i begge versioner. SDS-7362: Rettet så ny version af Status returnere StatusCode objekt. Lavet så andre snitflader findes i begge versioner.
No tags

nsp/integrationtest/src/test/java/dk/nsi/stamdata/personalinformation/_2024/_08/_01/PersonalInformationTest.java

Copied
17 17 * copies or substantial portions of the Software.
18 18 *
19 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 25 * SOFTWARE.
26 26 */
27 -package dk.nsi.stamdata.personalinformation;
27 +package dk.nsi.stamdata.personalinformation._2024._08._01;
28 28
29 29 import dk.nsi.stamdata.configuration.SDMContextConfiguration;
30 +import dk.nsi.stamdata.personalinformation.IntegrationTestConfiguration;
30 31 import dk.sosi.seal.model.AuthenticationLevel;
31 -import org.junit.*;
32 +import org.junit.Assert;
33 +import org.junit.Before;
34 +import org.junit.ClassRule;
35 +import org.junit.Rule;
36 +import org.junit.Test;
32 37 import org.junit.runner.RunWith;
33 38 import org.junit.runners.Parameterized;
34 -import org.openapitools.model.*;
39 +import org.openapitools.model.Age;
40 +import org.openapitools.model.Custody;
41 +import org.openapitools.model.Person;
42 +import org.openapitools.model.StatusCode;
35 43 import org.springframework.beans.factory.annotation.Value;
36 44 import org.springframework.test.context.ContextConfiguration;
37 45 import org.springframework.test.context.junit4.rules.SpringClassRule;
38 46 import org.springframework.test.context.junit4.rules.SpringMethodRule;
39 47
40 48 import java.time.LocalDate;
41 49 import java.time.Period;
42 50 import java.time.format.DateTimeFormatter;
43 51 import java.util.Map;
44 52
45 -import static dk.nsi.stamdata.personalinformation.IntegrationTestConfiguration.PersonInformationStatusServiceVersion.*;
46 -
47 -
48 53 @RunWith(Parameterized.class)
49 54 @ContextConfiguration(classes = SDMContextConfiguration.class )
50 55 public class PersonalInformationTest {
51 56
52 57 @ClassRule
53 58 public static final SpringClassRule scr = new SpringClassRule();
54 59
55 60 @Rule
56 61 public final SpringMethodRule smr = new SpringMethodRule();
57 62
64 69
65 70 private IntegrationTestConfiguration integrationTestConfiguration;
66 71
67 72 @Parameterized.Parameters(name = "{0}")
68 73 public static AuthenticationLevel[] data() {
69 74 return new AuthenticationLevel[]{AuthenticationLevel.VOCES_TRUSTED_SYSTEM};
70 75 }
71 76
72 77 @Before
73 78 public void setup() {
74 - integrationTestConfiguration = new IntegrationTestConfiguration();
79 + integrationTestConfiguration = new IntegrationTestConfiguration(personinformationEndpoint);
75 80 }
76 81
77 82 @Test
78 83 public void getPersonInformation() {
79 84 // Given
80 85 String cpr = "0304784567";
81 86
82 87 // When
83 - Person reponse = integrationTestConfiguration.callPersonInformationService(personinformationEndpoint, cpr);
88 + Person reponse = integrationTestConfiguration.callPersonInformationService("2024/08/01", cpr);
84 89
85 90 // Then
86 91 Assert.assertEquals("0304784567", reponse.getCpr());
87 92 }
88 93
89 94 @Test
90 - public void getPersonInformationStatusV1() {
91 - // Given
92 - String cpr = "0304784567";
93 -
94 - // When
95 - Status reponse = integrationTestConfiguration.callPersonInformationStatusService(personinformationEndpoint, V1, cpr);
96 -
97 - // Then
98 - Assert.assertEquals("1", reponse.getStatus().toString());
99 - }
100 -
101 - @Test
102 - public void getPersonInformationStatus_2024_08_01() {
95 + public void getPersonInformationStatus() {
103 96 // Given
104 97 String cpr = "0304784567";
105 98
106 99 // When
107 - Status reponse = integrationTestConfiguration.callPersonInformationStatusService(personinformationEndpoint, _2024_08_01, cpr);
100 + StatusCode reponse = integrationTestConfiguration.callPersonInformationStatusService(new StatusCode(), "2024/08/01", cpr);
108 101
109 102 // Then
110 - Assert.assertEquals("01", reponse.getStatus().toString());
103 + Assert.assertEquals("01", reponse.getStatusCode());
111 104 }
112 105
113 106 @Test
114 107 public void getPersonInformationAge() {
115 108 // Given
116 109 String cpr = "0304784567";
117 110
118 111 // When
119 - Age reponse = integrationTestConfiguration.callPersonInformationAgeService(personinformationEndpoint, cpr);
112 + Age reponse = integrationTestConfiguration.callPersonInformationAgeService("2024/08/01", cpr);
120 113
121 114 // Then
122 115
123 116 // convert cpr date to age
124 117 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
125 118 String birthDate = "03/04/1978";
126 119 int age = Period.between(LocalDate.parse(birthDate, formatter), LocalDate.now()).getYears();
127 120
128 121 Assert.assertEquals(age, reponse.getAge().intValue());
129 122 }
130 123 @Test
131 124 public void getPersonInformationBirthday() {
132 125 // Given
133 126 String cpr = "0304784567";
134 127
135 128 // When
136 - Map<String,String> reponse = integrationTestConfiguration.callPersonInformationBirthdayService(personinformationEndpoint, cpr);
129 + Map<String,String> reponse = integrationTestConfiguration.callPersonInformationBirthdayService("2024/08/01", cpr);
137 130
138 131 // Then
139 132 Assert.assertEquals("1978-04-03", reponse.get("birthday"));
140 133 }
141 134 @Test
142 135 public void getPersonInformationName() {
143 136 // Given
144 137 String cpr = "0304784567";
145 138
146 139 // When
147 - Map<String,String> reponse = integrationTestConfiguration.callPersonInformationNameService(personinformationEndpoint, cpr);
140 + Map<String,String> reponse = integrationTestConfiguration.callPersonInformationNameService("2024/08/01", cpr);
148 141
149 142 // Then
150 143 Assert.assertEquals("Egon", reponse.get("givenName"));
151 144 Assert.assertEquals("", reponse.get("middleName"));
152 145 Assert.assertEquals("Olsen", reponse.get("familyName"));
153 146 Assert.assertEquals("Egon Olsen", reponse.get("nameForAddressing"));
154 147 }
155 148 @Test
156 149 public void getPersonInformationCustody() {
157 150 // Given
158 151 String cpr = "1508902650";
159 152
160 153 // When
161 - Custody reponse = integrationTestConfiguration.callPersonInformationCustodyService(personinformationEndpoint, cpr);
154 + Custody reponse = integrationTestConfiguration.callPersonInformationCustodyService("2024/08/01", cpr);
162 155
163 156 // Then
164 157 Assert.assertEquals("0810503130", reponse.getWardCustody().get(0).getRelationCpr());
165 158 }
166 159 @Test
167 160 public void getPersonInformationAddress() {
168 161 // Given
169 162 String cpr = "0304784567";
170 163
171 164 // When
172 - Map<String,String> reponse = integrationTestConfiguration.callPersonInformationAddressService(personinformationEndpoint, cpr);
165 + Map<String,String> reponse = integrationTestConfiguration.callPersonInformationAddressService("2024/08/01", cpr);
173 166
174 167 // Then
175 168 Assert.assertEquals(3, reponse.size());
176 169 Assert.assertEquals("Bogenhøjvej 230", reponse.get("address"));
177 170 Assert.assertEquals("6666", reponse.get("zipCode"));
178 171 Assert.assertEquals("u00dcberwald", reponse.get("cityName"));
179 172 }
180 173 @Test
181 174 public void getPersonInformationAddressDeceased() {
182 175 // Given
183 176 String cpr = "1234567896"; // Cpr er sat til at have status 90, dvs. død
184 177
185 178 // When
186 - Map<String,String> reponse = integrationTestConfiguration.callPersonInformationAddressService(personinformationEndpoint, cpr);
179 + Map<String,String> reponse = integrationTestConfiguration.callPersonInformationAddressService("2024/08/01", cpr);
187 180
188 181 // Then
189 182 Assert.assertEquals(0, reponse.size());
190 183 }
191 184 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut