@@ -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" ,
@@ -776,9 +769,7 @@ public void test() throws Exception {
776
769
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
777
770
778
771
resultAsString = result .getResponse ().getContentAsString ();
779
- List <CreatedStudyBasicInfos > createdStudyBasicInfosList = mapper .readValue (resultAsString ,
780
- new TypeReference <List <CreatedStudyBasicInfos >>() {
781
- });
772
+ List <CreatedStudyBasicInfos > createdStudyBasicInfosList = mapper .readValue (resultAsString , new TypeReference <>() { });
782
773
783
774
assertThat (createdStudyBasicInfosList .get (0 ), createMatcherCreatedStudyBasicInfos (studyUuid , "UCTE" ));
784
775
@@ -789,9 +780,7 @@ public void test() throws Exception {
789
780
resultAsString = mockMvc .perform (get ("/v1/studies" ).header ("userId" , "userId2" ))
790
781
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ().getResponse ().getContentAsString ();
791
782
792
- createdStudyBasicInfosList = mapper .readValue (resultAsString ,
793
- new TypeReference <List <CreatedStudyBasicInfos >>() {
794
- });
783
+ createdStudyBasicInfosList = mapper .readValue (resultAsString , new TypeReference <>() { });
795
784
796
785
assertThat (createdStudyBasicInfosList .get (1 ),
797
786
createMatcherCreatedStudyBasicInfos (studyUuid , "UCTE" ));
@@ -811,9 +800,7 @@ public void test() throws Exception {
811
800
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
812
801
813
802
resultAsString = result .getResponse ().getContentAsString ();
814
- createdStudyBasicInfosList = mapper .readValue (resultAsString ,
815
- new TypeReference <List <CreatedStudyBasicInfos >>() {
816
- });
803
+ createdStudyBasicInfosList = mapper .readValue (resultAsString , new TypeReference <>() { });
817
804
assertEquals (2 , createdStudyBasicInfosList .size ());
818
805
819
806
//get available export format
@@ -958,9 +945,7 @@ public void testMetadata() throws Exception {
958
945
.header (USER_ID_HEADER , "userId" ))
959
946
.andExpectAll (status ().isOk (), content ().contentType (MediaType .APPLICATION_JSON )).andReturn ();
960
947
String resultAsString = mvcResult .getResponse ().getContentAsString ();
961
- List <CreatedStudyBasicInfos > createdStudyBasicInfosList = mapper .readValue (resultAsString ,
962
- new TypeReference <List <CreatedStudyBasicInfos >>() {
963
- });
948
+ List <CreatedStudyBasicInfos > createdStudyBasicInfosList = mapper .readValue (resultAsString , new TypeReference <>() { });
964
949
965
950
assertNotNull (createdStudyBasicInfosList );
966
951
assertEquals (2 , createdStudyBasicInfosList .size ());
@@ -994,7 +979,7 @@ public void testLogsReport() throws Exception {
994
979
MvcResult mvcResult = mockMvc .perform (get ("/v1/studies/{studyUuid}/nodes/{nodeUuid}/parent-nodes-report?reportType=NETWORK_MODIFICATION" , studyUuid , rootNodeUuid ).header (USER_ID_HEADER , "userId" ))
995
980
.andExpect (status ().isOk ()).andReturn ();
996
981
String resultAsString = mvcResult .getResponse ().getContentAsString ();
997
- List <ReportNode > reporterModel = mapper .readValue (resultAsString , new TypeReference <List < ReportNode > >() { });
982
+ List <ReportNode > reporterModel = mapper .readValue (resultAsString , new TypeReference <>() { });
998
983
999
984
assertThat (reporterModel .get (0 ), new MatcherReport (REPORT_TEST ));
1000
985
assertTrue (TestUtils .getRequestsDone (1 , server ).stream ().anyMatch (r -> r .matches ("/v1/reports/.*" )));
@@ -1171,7 +1156,7 @@ public void testCreateStudyWithErrorDuringCaseImport() throws Exception {
1171
1156
.andReturn ();
1172
1157
1173
1158
String resultAsString = mvcResult .getResponse ().getContentAsString ();
1174
- List <BasicStudyInfos > bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1159
+ List <BasicStudyInfos > bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1175
1160
1176
1161
assertEquals (List .of (), bsiListResult );
1177
1162
@@ -1241,7 +1226,7 @@ public void testGetStudyCreationRequests() throws Exception {
1241
1226
content ().contentType (MediaType .APPLICATION_JSON ))
1242
1227
.andReturn ();
1243
1228
resultAsString = mvcResult .getResponse ().getContentAsString ();
1244
- List <BasicStudyInfos > bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1229
+ List <BasicStudyInfos > bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1245
1230
1246
1231
// once we checked study creation requests, we can countDown latch to trigger study creation request
1247
1232
countDownLatch .countDown ();
@@ -1261,7 +1246,7 @@ public void testGetStudyCreationRequests() throws Exception {
1261
1246
.andReturn ();
1262
1247
1263
1248
resultAsString = mvcResult .getResponse ().getContentAsString ();
1264
- bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1249
+ bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1265
1250
1266
1251
assertEquals (List .of (), bsiListResult );
1267
1252
@@ -1271,7 +1256,7 @@ public void testGetStudyCreationRequests() throws Exception {
1271
1256
.andReturn ();
1272
1257
1273
1258
resultAsString = mvcResult .getResponse ().getContentAsString ();
1274
- List <CreatedStudyBasicInfos > csbiListResponse = mapper .readValue (resultAsString , new TypeReference <List < CreatedStudyBasicInfos > >() { });
1259
+ List <CreatedStudyBasicInfos > csbiListResponse = mapper .readValue (resultAsString , new TypeReference <>() { });
1275
1260
1276
1261
countDownLatch = new CountDownLatch (1 );
1277
1262
@@ -1294,7 +1279,7 @@ public void testGetStudyCreationRequests() throws Exception {
1294
1279
.andReturn ();
1295
1280
resultAsString = mvcResult .getResponse ().getContentAsString ();
1296
1281
1297
- bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1282
+ bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1298
1283
1299
1284
countDownLatch .countDown ();
1300
1285
@@ -1314,7 +1299,7 @@ public void testGetStudyCreationRequests() throws Exception {
1314
1299
.andReturn ();
1315
1300
resultAsString = mvcResult .getResponse ().getContentAsString ();
1316
1301
1317
- bsiListResult = mapper .readValue (resultAsString , new TypeReference <List < BasicStudyInfos > >() { });
1302
+ bsiListResult = mapper .readValue (resultAsString , new TypeReference <>() { });
1318
1303
1319
1304
assertEquals (List .of (), bsiListResult );
1320
1305
@@ -1324,7 +1309,7 @@ public void testGetStudyCreationRequests() throws Exception {
1324
1309
content ().contentType (MediaType .APPLICATION_JSON ))
1325
1310
.andReturn ();
1326
1311
resultAsString = mvcResult .getResponse ().getContentAsString ();
1327
- csbiListResponse = mapper .readValue (resultAsString , new TypeReference <List < CreatedStudyBasicInfos > >() { });
1312
+ csbiListResponse = mapper .readValue (resultAsString , new TypeReference <>() { });
1328
1313
1329
1314
// assert that all http requests have been sent to remote services
1330
1315
var requests = TestUtils .getRequestsDone (7 , server );
@@ -1370,8 +1355,7 @@ private void checkNodeBuildStatusUpdatedMessageReceived(UUID studyUuid, List<UUI
1370
1355
private void checkEquipmentMessagesReceived (UUID studyNameUserIdUuid , UUID nodeUuid , NetworkImpactsInfos expectedPayload ) throws Exception {
1371
1356
// assert that the broker message has been sent for updating study type
1372
1357
Message <byte []> messageStudyUpdate = output .receive (TIMEOUT , studyUpdateDestination );
1373
- NetworkImpactsInfos actualPayload = mapper .readValue (new String (messageStudyUpdate .getPayload ()), new TypeReference <NetworkImpactsInfos >() {
1374
- });
1358
+ NetworkImpactsInfos actualPayload = mapper .readValue (new String (messageStudyUpdate .getPayload ()), new TypeReference <>() { });
1375
1359
assertThat (expectedPayload , new MatcherJson <>(mapper , actualPayload ));
1376
1360
MessageHeaders headersStudyUpdate = messageStudyUpdate .getHeaders ();
1377
1361
assertEquals (studyNameUserIdUuid , headersStudyUpdate .get (NotificationService .HEADER_STUDY_UUID ));
0 commit comments