private void validateParameters(List<Parameter> actualOperationParameters, List<Parameter> expectedOperationParameters, String httpMethod, String path) { String message = String.format("Checking parameters of '%s' operation of path '%s'", httpMethod, path); if (CollectionUtils.isNotEmpty(expectedOperationParameters)) { softAssertions.assertThat(actualOperationParameters).as(message).isNotEmpty(); if (CollectionUtils.isNotEmpty(actualOperationParameters)) { softAssertions.assertThat(actualOperationParameters).as(message).hasSameSizeAs(expectedOperationParameters); softAssertions.assertThat(actualOperationParameters).as(message).usingElementComparatorOnFields("in", "name", "required").hasSameElementsAs(expectedOperationParameters); Map<String, Parameter> expectedParametersAsMap = new HashMap<>(); for (Parameter expectedParameter : expectedOperationParameters) { expectedParametersAsMap.put(expectedParameter.getName(), expectedParameter); } for (Parameter actualParameter : actualOperationParameters) { String parameterName = actualParameter.getName(); Parameter expectedParameter = expectedParametersAsMap.get(parameterName); validateParameter(actualParameter, expectedParameter, parameterName, httpMethod, path); } } } else { softAssertions.assertThat(actualOperationParameters).as(message).isNullOrEmpty(); } }