@@ -397,8 +397,7 @@ public MockResponse dispatch(RecordedRequest request) {
397
397
return new MockResponse ().setResponseCode (200 )
398
398
.addHeader ("Content-Type" , "application/json; charset=utf-8" );
399
399
} else if (path .matches ("/v1/network-modifications.*" ) && POST .equals (request .getMethod ())) {
400
- ModificationInfos modificationInfos = mapper .readValue (body .readUtf8 (), new TypeReference <ModificationInfos >() {
401
- });
400
+ ModificationInfos modificationInfos = mapper .readValue (body .readUtf8 (), new TypeReference <>() { });
402
401
modificationInfos .setSubstationIds (Set .of ("s2" ));
403
402
return new MockResponse ().setResponseCode (200 )
404
403
.setBody ("[" + mapper .writeValueAsString (modificationInfos ) + "]" )
@@ -697,37 +696,31 @@ public void testSearch() throws Exception {
697
696
.perform (get ("/v1/search?q={request}" , String .format ("userId:%s" , "userId" )).header (USER_ID_HEADER , "userId" ))
698
697
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
699
698
resultAsString = mvcResult .getResponse ().getContentAsString ();
700
- List <CreatedStudyBasicInfos > createdStudyBasicInfosList = mapper .readValue (resultAsString ,
701
- new TypeReference <List <CreatedStudyBasicInfos >>() {
702
- });
699
+ List <CreatedStudyBasicInfos > createdStudyBasicInfosList = mapper .readValue (resultAsString , new TypeReference <>() { });
703
700
assertThat (createdStudyBasicInfosList , new MatcherJson <>(mapper , studiesInfos ));
704
701
705
702
mvcResult = mockMvc
706
703
.perform (get ("/v1/studies/{studyUuid}/nodes/{nodeUuid}/search?userInput={request}&fieldSelector=NAME" ,
707
704
studyUuid , rootNodeId , "B" ).header (USER_ID_HEADER , "userId" ))
708
705
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
709
706
resultAsString = mvcResult .getResponse ().getContentAsString ();
710
- List <EquipmentInfos > equipmentInfos = mapper .readValue (resultAsString ,
711
- new TypeReference <List <EquipmentInfos >>() {
712
- });
707
+ List <EquipmentInfos > equipmentInfos = mapper .readValue (resultAsString , new TypeReference <>() { });
713
708
assertThat (equipmentInfos , new MatcherJson <>(mapper , linesInfos ));
714
709
715
710
mvcResult = mockMvc
716
711
.perform (get ("/v1/studies/{studyUuid}/nodes/{nodeUuid}/search?userInput={request}&fieldSelector=NAME" ,
717
712
studyUuid , rootNodeId , "B" ).header (USER_ID_HEADER , "userId" ))
718
713
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
719
714
resultAsString = mvcResult .getResponse ().getContentAsString ();
720
- equipmentInfos = mapper .readValue (resultAsString , new TypeReference <List <EquipmentInfos >>() {
721
- });
715
+ equipmentInfos = mapper .readValue (resultAsString , new TypeReference <>() { });
722
716
assertThat (equipmentInfos , new MatcherJson <>(mapper , linesInfos ));
723
717
724
718
mvcResult = mockMvc
725
719
.perform (get ("/v1/studies/{studyUuid}/nodes/{nodeUuid}/search?userInput={request}&fieldSelector=ID" ,
726
720
studyUuid , rootNodeId , "B" ).header (USER_ID_HEADER , "userId" ))
727
721
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
728
722
resultAsString = mvcResult .getResponse ().getContentAsString ();
729
- equipmentInfos = mapper .readValue (resultAsString , new TypeReference <List <EquipmentInfos >>() {
730
- });
723
+ equipmentInfos = mapper .readValue (resultAsString , new TypeReference <>() { });
731
724
assertThat (equipmentInfos , new MatcherJson <>(mapper , linesInfos ));
732
725
733
726
mockMvc .perform (get ("/v1/studies/{studyUuid}/nodes/{nodeUuid}/search?userInput={request}&fieldSelector=bogus" ,
@@ -789,9 +782,7 @@ public void test() throws Exception {
789
782
resultAsString = mockMvc .perform (get ("/v1/studies" ).header ("userId" , "userId2" ))
790
783
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ().getResponse ().getContentAsString ();
791
784
792
- createdStudyBasicInfosList = mapper .readValue (resultAsString ,
793
- new TypeReference <List <CreatedStudyBasicInfos >>() {
794
- });
785
+ createdStudyBasicInfosList = mapper .readValue (resultAsString , new TypeReference <>() { });
795
786
796
787
assertThat (createdStudyBasicInfosList .get (1 ),
797
788
createMatcherCreatedStudyBasicInfos (studyUuid , "UCTE" ));
@@ -811,9 +802,7 @@ public void test() throws Exception {
811
802
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
812
803
813
804
resultAsString = result .getResponse ().getContentAsString ();
814
- createdStudyBasicInfosList = mapper .readValue (resultAsString ,
815
- new TypeReference <List <CreatedStudyBasicInfos >>() {
816
- });
805
+ createdStudyBasicInfosList = mapper .readValue (resultAsString , new TypeReference <>() { });
817
806
assertEquals (2 , createdStudyBasicInfosList .size ());
818
807
819
808
//get available export format
@@ -958,9 +947,7 @@ public void testMetadata() throws Exception {
958
947
.header (USER_ID_HEADER , "userId" ))
959
948
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
960
949
String resultAsString = mvcResult .getResponse ().getContentAsString ();
961
- List <CreatedStudyBasicInfos > createdStudyBasicInfosList = mapper .readValue (resultAsString ,
962
- new TypeReference <List <CreatedStudyBasicInfos >>() {
963
- });
950
+ List <CreatedStudyBasicInfos > createdStudyBasicInfosList = mapper .readValue (resultAsString , new TypeReference <>() { });
964
951
965
952
assertNotNull (createdStudyBasicInfosList );
966
953
assertEquals (2 , createdStudyBasicInfosList .size ());
@@ -994,7 +981,7 @@ public void testLogsReport() throws Exception {
994
981
MvcResult mvcResult = mockMvc .perform (get ("/v1/studies/{studyUuid}/nodes/{nodeUuid}/parent-nodes-report?reportType=NETWORK_MODIFICATION" , studyUuid , rootNodeUuid ).header (USER_ID_HEADER , "userId" ))
995
982
.andExpect (status ().isOk ()).andReturn ();
996
983
String resultAsString = mvcResult .getResponse ().getContentAsString ();
997
- List <ReportNode > reporterModel = mapper .readValue (resultAsString , new TypeReference <List < ReportNode > >() { });
984
+ List <ReportNode > reporterModel = mapper .readValue (resultAsString , new TypeReference <>() { });
998
985
999
986
assertThat (reporterModel .get (0 ), new MatcherReport (REPORT_TEST ));
1000
987
assertTrue (TestUtils .getRequestsDone (1 , server ).stream ().anyMatch (r -> r .matches ("/v1/reports/.*" )));
@@ -1171,7 +1158,7 @@ public void testCreateStudyWithErrorDuringCaseImport() throws Exception {
1171
1158
.andReturn ();
1172
1159
1173
1160
String resultAsString = mvcResult .getResponse ().getContentAsString ();
1174
- List <BasicStudyInfos > bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1161
+ List <BasicStudyInfos > bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1175
1162
1176
1163
assertEquals (List .of (), bsiListResult );
1177
1164
@@ -1241,7 +1228,7 @@ public void testGetStudyCreationRequests() throws Exception {
1241
1228
content ().contentType (MediaType .APPLICATION_JSON ))
1242
1229
.andReturn ();
1243
1230
resultAsString = mvcResult .getResponse ().getContentAsString ();
1244
- List <BasicStudyInfos > bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1231
+ List <BasicStudyInfos > bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1245
1232
1246
1233
// once we checked study creation requests, we can countDown latch to trigger study creation request
1247
1234
countDownLatch .countDown ();
@@ -1261,7 +1248,7 @@ public void testGetStudyCreationRequests() throws Exception {
1261
1248
.andReturn ();
1262
1249
1263
1250
resultAsString = mvcResult .getResponse ().getContentAsString ();
1264
- bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1251
+ bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1265
1252
1266
1253
assertEquals (List .of (), bsiListResult );
1267
1254
@@ -1271,7 +1258,7 @@ public void testGetStudyCreationRequests() throws Exception {
1271
1258
.andReturn ();
1272
1259
1273
1260
resultAsString = mvcResult .getResponse ().getContentAsString ();
1274
- List <CreatedStudyBasicInfos > csbiListResponse = mapper .readValue (resultAsString , new TypeReference <List < CreatedStudyBasicInfos > >() { });
1261
+ List <CreatedStudyBasicInfos > csbiListResponse = mapper .readValue (resultAsString , new TypeReference <>() { });
1275
1262
1276
1263
countDownLatch = new CountDownLatch (1 );
1277
1264
@@ -1294,7 +1281,7 @@ public void testGetStudyCreationRequests() throws Exception {
1294
1281
.andReturn ();
1295
1282
resultAsString = mvcResult .getResponse ().getContentAsString ();
1296
1283
1297
- bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1284
+ bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1298
1285
1299
1286
countDownLatch .countDown ();
1300
1287
@@ -1314,7 +1301,7 @@ public void testGetStudyCreationRequests() throws Exception {
1314
1301
.andReturn ();
1315
1302
resultAsString = mvcResult .getResponse ().getContentAsString ();
1316
1303
1317
- bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1304
+ bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1318
1305
1319
1306
assertEquals (List .of (), bsiListResult );
1320
1307
@@ -1324,7 +1311,7 @@ public void testGetStudyCreationRequests() throws Exception {
1324
1311
content ().contentType (MediaType .APPLICATION_JSON ))
1325
1312
.andReturn ();
1326
1313
resultAsString = mvcResult .getResponse ().getContentAsString ();
1327
- csbiListResponse = mapper .readValue (resultAsString , new TypeReference <List < CreatedStudyBasicInfos > >() { });
1314
+ csbiListResponse = mapper .readValue (resultAsString , new TypeReference <>() { });
1328
1315
1329
1316
// assert that all http requests have been sent to remote services
1330
1317
var requests = TestUtils .getRequestsDone (7 , server );
@@ -1370,8 +1357,7 @@ private void checkNodeBuildStatusUpdatedMessageReceived(UUID studyUuid, List<UUI
1370
1357
private void checkEquipmentMessagesReceived (UUID studyNameUserIdUuid , UUID nodeUuid , NetworkImpactsInfos expectedPayload ) throws Exception {
1371
1358
// assert that the broker message has been sent for updating study type
1372
1359
Message <byte []> messageStudyUpdate = output .receive (TIMEOUT , studyUpdateDestination );
1373
- NetworkImpactsInfos actualPayload = mapper .readValue (new String (messageStudyUpdate .getPayload ()), new TypeReference <NetworkImpactsInfos >() {
1374
- });
1360
+ NetworkImpactsInfos actualPayload = mapper .readValue (new String (messageStudyUpdate .getPayload ()), new TypeReference <>() { });
1375
1361
assertThat (expectedPayload , new MatcherJson <>(mapper , actualPayload ));
1376
1362
MessageHeaders headersStudyUpdate = messageStudyUpdate .getHeaders ();
1377
1363
assertEquals (studyNameUserIdUuid , headersStudyUpdate .get (NotificationService .HEADER_STUDY_UUID ));
0 commit comments