1
1
package io .mosip .kernel .masterdata .test .integration ;
2
2
3
- import static org .hamcrest .CoreMatchers .is ;
4
- import static org .hamcrest .CoreMatchers .isA ;
5
- import static org .junit .Assert .assertNotNull ;
6
- import static org .junit .Assert .assertThat ;
7
- import static org .mockito .ArgumentMatchers .any ;
8
- import static org .mockito .ArgumentMatchers .anyInt ;
9
- import static org .mockito .ArgumentMatchers .anyString ;
10
- import static org .mockito .Mockito .doNothing ;
11
- import static org .mockito .Mockito .when ;
12
- import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .delete ;
13
- import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .get ;
14
- import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .post ;
15
- import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .put ;
16
- import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .jsonPath ;
17
- import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
18
-
19
- import java .sql .Timestamp ;
20
- import java .time .LocalDate ;
21
- import java .time .LocalDateTime ;
22
- import java .time .LocalTime ;
23
- import java .time .Month ;
24
- import java .time .ZoneId ;
25
- import java .time .ZoneOffset ;
26
- import java .time .format .DateTimeFormatter ;
27
- import java .util .*;
28
-
29
- import io .mosip .kernel .masterdata .test .utils .MasterDataTest ;
30
- import org .junit .Assert ;
31
- import org .junit .Before ;
32
- import org .junit .Ignore ;
33
- import org .junit .Test ;
34
- import org .junit .runner .RunWith ;
35
- import org .mockito .ArgumentMatchers ;
36
- import org .mockito .Mockito ;
37
- import org .springframework .beans .factory .annotation .Autowired ;
38
- import org .springframework .beans .factory .annotation .Qualifier ;
39
- import org .springframework .beans .factory .annotation .Value ;
40
- import org .springframework .boot .test .autoconfigure .web .servlet .AutoConfigureMockMvc ;
41
- import org .springframework .boot .test .autoconfigure .web .servlet .MockMvcPrint ;
42
- import org .springframework .boot .test .context .SpringBootTest ;
43
- import org .springframework .boot .test .mock .mockito .MockBean ;
44
- import org .springframework .dao .DataRetrievalFailureException ;
45
- import org .springframework .data .domain .Page ;
46
- import org .springframework .data .domain .PageImpl ;
47
- import org .springframework .data .domain .PageRequest ;
48
- import org .springframework .data .domain .Pageable ;
49
- import org .springframework .data .domain .Sort ;
50
- import org .springframework .data .domain .Sort .Direction ;
51
- import org .springframework .http .HttpEntity ;
52
- import org .springframework .http .HttpHeaders ;
53
- import org .springframework .http .HttpMethod ;
54
- import org .springframework .http .HttpStatus ;
55
- import org .springframework .http .MediaType ;
56
- import org .springframework .http .ResponseEntity ;
57
- import org .springframework .security .test .context .support .WithUserDetails ;
58
- import org .springframework .test .context .junit4 .SpringRunner ;
59
- import org .springframework .test .web .servlet .MockMvc ;
60
- import org .springframework .test .web .servlet .MvcResult ;
61
- import org .springframework .test .web .servlet .request .MockMvcRequestBuilders ;
62
- import org .springframework .test .web .servlet .result .MockMvcResultMatchers ;
63
- import org .springframework .transaction .annotation .Propagation ;
64
- import org .springframework .transaction .annotation .Transactional ;
65
- import org .springframework .web .client .RestTemplate ;
66
-
67
3
import com .fasterxml .jackson .core .JsonProcessingException ;
68
4
import com .fasterxml .jackson .databind .ObjectMapper ;
69
5
import com .fasterxml .jackson .databind .SerializationFeature ;
70
6
import com .fasterxml .jackson .datatype .jsr310 .JavaTimeModule ;
71
7
import com .fasterxml .jackson .datatype .jsr310 .deser .LocalTimeDeserializer ;
72
8
import com .fasterxml .jackson .datatype .jsr310 .ser .LocalDateTimeSerializer ;
73
-
74
9
import io .mosip .kernel .core .dataaccess .exception .DataAccessLayerException ;
75
10
import io .mosip .kernel .core .http .RequestWrapper ;
76
11
import io .mosip .kernel .core .http .ResponseWrapper ;
192
127
import io .mosip .kernel .masterdata .entity .id .RegistrationCenterMachineDeviceHistoryID ;
193
128
import io .mosip .kernel .masterdata .entity .id .RegistrationCenterMachineDeviceID ;
194
129
import io .mosip .kernel .masterdata .entity .id .RegistrationCenterMachineUserHistoryID ;
195
- import io .mosip .kernel .masterdata .exception .DataNotFoundException ;
196
130
import io .mosip .kernel .masterdata .exception .MasterDataServiceException ;
197
131
import io .mosip .kernel .masterdata .exception .RequestException ;
198
132
import io .mosip .kernel .masterdata .repository .ApplicantValidDocumentRepository ;
244
178
import io .mosip .kernel .masterdata .repository .ZoneUserHistoryRepository ;
245
179
import io .mosip .kernel .masterdata .repository .ZoneUserRepository ;
246
180
import io .mosip .kernel .masterdata .test .TestBootApplication ;
181
+ import io .mosip .kernel .masterdata .test .utils .MasterDataTest ;
247
182
import io .mosip .kernel .masterdata .utils .AuditUtil ;
248
183
import io .mosip .kernel .masterdata .utils .MapperUtils ;
249
184
import io .mosip .kernel .masterdata .utils .MasterdataCreationUtil ;
250
185
import io .mosip .kernel .masterdata .utils .RegistrationCenterValidator ;
251
186
import io .mosip .kernel .masterdata .utils .ZoneUtils ;
187
+ import org .junit .Assert ;
188
+ import org .junit .Before ;
189
+ import org .junit .Ignore ;
190
+ import org .junit .Test ;
191
+ import org .junit .runner .RunWith ;
192
+ import org .mockito .ArgumentMatchers ;
193
+ import org .mockito .Mockito ;
194
+ import org .springframework .beans .factory .annotation .Autowired ;
195
+ import org .springframework .beans .factory .annotation .Qualifier ;
196
+ import org .springframework .beans .factory .annotation .Value ;
197
+ import org .springframework .boot .test .autoconfigure .web .servlet .AutoConfigureMockMvc ;
198
+ import org .springframework .boot .test .autoconfigure .web .servlet .MockMvcPrint ;
199
+ import org .springframework .boot .test .context .SpringBootTest ;
200
+ import org .springframework .boot .test .mock .mockito .MockBean ;
201
+ import org .springframework .dao .DataRetrievalFailureException ;
202
+ import org .springframework .data .domain .Page ;
203
+ import org .springframework .data .domain .PageImpl ;
204
+ import org .springframework .data .domain .PageRequest ;
205
+ import org .springframework .data .domain .Pageable ;
206
+ import org .springframework .data .domain .Sort ;
207
+ import org .springframework .data .domain .Sort .Direction ;
208
+ import org .springframework .http .HttpEntity ;
209
+ import org .springframework .http .HttpHeaders ;
210
+ import org .springframework .http .HttpMethod ;
211
+ import org .springframework .http .HttpStatus ;
212
+ import org .springframework .http .MediaType ;
213
+ import org .springframework .http .ResponseEntity ;
214
+ import org .springframework .security .test .context .support .WithUserDetails ;
215
+ import org .springframework .test .context .junit4 .SpringRunner ;
216
+ import org .springframework .test .web .servlet .MockMvc ;
217
+ import org .springframework .test .web .servlet .MvcResult ;
218
+ import org .springframework .test .web .servlet .request .MockMvcRequestBuilders ;
219
+ import org .springframework .test .web .servlet .result .MockMvcResultMatchers ;
220
+ import org .springframework .transaction .annotation .Propagation ;
221
+ import org .springframework .transaction .annotation .Transactional ;
222
+ import org .springframework .web .client .RestTemplate ;
223
+
224
+ import java .sql .Timestamp ;
225
+ import java .time .LocalDate ;
226
+ import java .time .LocalDateTime ;
227
+ import java .time .LocalTime ;
228
+ import java .time .Month ;
229
+ import java .time .ZoneId ;
230
+ import java .time .ZoneOffset ;
231
+ import java .time .format .DateTimeFormatter ;
232
+ import java .util .List ;
233
+ import java .util .ArrayList ;
234
+ import java .util .Arrays ;
235
+ import java .util .Set ;
236
+ import java .util .HashSet ;
237
+ import java .util .Collections ;
238
+ import java .util .Map ;
239
+ import java .util .HashMap ;
240
+ import java .util .Optional ;
241
+
242
+ import static org .hamcrest .CoreMatchers .is ;
243
+ import static org .hamcrest .CoreMatchers .isA ;
244
+ import static org .junit .Assert .assertNotNull ;
245
+ import static org .junit .Assert .assertThat ;
246
+ import static org .mockito .ArgumentMatchers .any ;
247
+ import static org .mockito .ArgumentMatchers .anyInt ;
248
+ import static org .mockito .ArgumentMatchers .anyString ;
249
+ import static org .mockito .Mockito .doNothing ;
250
+ import static org .mockito .Mockito .when ;
251
+ import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .delete ;
252
+ import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .get ;
253
+ import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .post ;
254
+ import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .put ;
255
+ import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .jsonPath ;
256
+ import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
252
257
253
258
/**
254
259
*
@@ -2009,9 +2014,10 @@ public void addHolidayTypeLanguageValidationTest() throws Exception {
2009
2014
public void addHolidayTypeExceptionTest () throws Exception {
2010
2015
2011
2016
String json = "{\n " + " \" id\" : \" string\" ,\n " + " \" metadata\" : {},\n " + " \" request\" : {\n "
2012
- + " \" holidayDate\" : \" 2019-01-01\" ,\n " + " \" holidayDesc\" : \" New Year\" ,\n "
2013
- + " \" holidayName\" : \" New Year\" ,\n "
2014
- + " \" isActive\" : true,\n " + " \" langCode\" : \" eng\" ,\n " + " \" locationCode\" : \" BLR\" \n "
2017
+ + " \" holidayDate\" : \" 2019-01-01\" ,\n " + " \" holidayDay\" : \" Sunday\" ,\n "
2018
+ + " \" holidayDesc\" : \" New Year\" ,\n " + " \" holidayMonth\" : \" January\" ,\n "
2019
+ + " \" holidayName\" : \" New Year\" ,\n " + " \" holidayYear\" : \" 2019\" ,\n " + " \" id\" : 1,\n "
2020
+ + " \" isActive\" : true,\n " + " \" langCode\" : \" asd\" ,\n " + " \" locationCode\" : \" BLR\" \n "
2015
2021
+ " },\n " + " \" requesttime\" : \" 2018-12-06T08:49:32.190Z\" ,\n " + " \" version\" : \" string\" \n " + "}" ;
2016
2022
when (holidayRepository .create (Mockito .any ()))
2017
2023
.thenThrow (new DataAccessLayerException ("" , "cannot execute " , null ));
@@ -2035,7 +2041,7 @@ public void addHolidayTypeExceptionTest() throws Exception {
2035
2041
ResponseWrapper <?> responseWrapper = objectMapper .readValue (result .getResponse ().getContentAsString (),
2036
2042
ResponseWrapper .class );
2037
2043
2038
- assertThat (responseWrapper .getErrors ().get (0 ).getErrorCode (), is ("KER-MSD-729 " ));
2044
+ assertThat (responseWrapper .getErrors ().get (0 ).getErrorCode (), is ("KER-MSD-999 " ));
2039
2045
}
2040
2046
2041
2047
// -----------------------------IdTypeTest----------------------------------
0 commit comments