mess9

Untitled

Dec 10th, 2020
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 31.32 KB | None | 0 0
  1. package ru.rostelecom.eip2.steps.payments;
  2.  
  3. import io.qameta.allure.Step;
  4. import org.apache.logging.log4j.LogManager;
  5. import org.apache.logging.log4j.Logger;
  6. import org.assertj.core.api.SoftAssertions;
  7. import ru.rostelecom.database.entities.dto.mdm.PaymentDto;
  8. import ru.rostelecom.model.Payment;
  9. import ru.rostelecom.model.PaymentResponse;
  10.  
  11. import java.util.ArrayList;
  12. import java.util.Date;
  13. import java.util.List;
  14.  
  15. import static org.assertj.core.api.Assertions.assertThat;
  16. import static ru.rostelecom.execution.jira.Watcher.TEST_STEP_MARKER;
  17.  
  18. public class PaymentResponseAssertionSteps {
  19.  
  20.     private static final Logger LOGGER = LogManager.getLogger(PaymentResponseAssertionSteps.class);
  21.  
  22.     @Step("Проверяем ответ от сервиса по платежам с пагинацией. " + TEST_STEP_MARKER)
  23.     public static void assertPaymentResponseWithPagination(
  24.             final String testCaseKey,
  25.             final Integer stepNumber,
  26.             final PaymentResponse paymentResponse,
  27.             final Number pageNumber,
  28.             final Number totalCount,
  29.             final Number fetchCount,
  30.             final Number pageCount,
  31.             final List<PaymentDto> dbPayments
  32.     ) {
  33.  
  34.         SoftAssertions.assertSoftly(softly -> {
  35.             softly.assertThat(paymentResponse.getPageNum())
  36.                     .as(
  37.                             "В ответе от сервиса pagNum %s должен быть равен переданному параметру %s",
  38.                             paymentResponse.getPageNum(),
  39.                             pageNumber
  40.                     )
  41.                     .isEqualTo(pageNumber);
  42.  
  43.             softly.assertThat(paymentResponse.getTotalCount())
  44.                     .as(
  45.                             "В ответе от сервиса totalCount: %s должен равен количеству записей в БД: %s",
  46.                             paymentResponse.getTotalCount(),
  47.                             totalCount
  48.                     )
  49.                     .isEqualTo(totalCount);
  50.  
  51.             softly.assertThat(paymentResponse.getFetchCount())
  52.                     .as(
  53.                             "В ответе от сервиса fetchCount %d должен быть равен переданному значению: %d, " +
  54.                                     "количеству объектов в поле dtos JSON-объекта: %d",
  55.                             paymentResponse.getFetchCount(),
  56.                             fetchCount,
  57.                             paymentResponse.getDtos().size()
  58.                     )
  59.                     .isEqualTo(fetchCount)
  60.                     .isEqualTo(paymentResponse.getDtos().size());
  61.  
  62.             softly.assertThat(paymentResponse.getPageCount())
  63.                     .as(
  64.                             "В ответе от сервиса pageCount %s должен быть равен %s"
  65.                     )
  66.                     .isEqualTo(pageCount);
  67.         });
  68.  
  69.         assertListsOfServicePaymentsAndDbPayments(paymentResponse.getDtos(), dbPayments);
  70.     }
  71.  
  72.     @Step("Проверяем ответ от сервиса по платежам и фильтрацией по дате. " + TEST_STEP_MARKER)
  73.     public static void assertPaymentResponseContainsFilteredData(
  74.             final String testCaseKey,
  75.             final Integer stepNumber,
  76.             final PaymentResponse paymentResponse,
  77.             final List<PaymentDto> dbPayments,
  78.             final Date dateFrom,
  79.             final Date dateTo) {
  80.  
  81.         paymentResponse.getDtos().forEach(payment -> assertThat(payment.getRegDateTime())
  82.                 .as("REGDATETIME платежа: %s должен быть в диапазоне от %s и до %s",
  83.                         payment.getRegDateTime(),
  84.                         dateFrom,
  85.                         dateTo)
  86.                 .isBetween(dateFrom, dateTo));
  87.  
  88.         assertListsOfServicePaymentsAndDbPayments(paymentResponse.getDtos(), dbPayments);
  89.     }
  90.  
  91.     @Step("Проверяем ответ от сервиса по платежам и фильтрацией по дате. " + TEST_STEP_MARKER)
  92.     public static void assertPaymentResponseContainsFilteredDateFrom(
  93.             final String testCaseKey,
  94.             final Integer stepNumber,
  95.             final PaymentResponse paymentResponse,
  96.             final List<PaymentDto> dbPayments,
  97.             final Date dateFrom) {
  98.  
  99.         paymentResponse.getDtos().forEach(payment -> assertThat(payment.getRegDateTime())
  100.                 .as("REGDATETIME платежа: %s должен быть начинаться от %s", payment.getRegDateTime(), dateFrom)
  101.                 .isAfter(dateFrom));
  102.  
  103.         assertListsOfServicePaymentsAndDbPayments(paymentResponse.getDtos(), dbPayments);
  104.     }
  105.  
  106.     @Step("Проверяем ответ от сервиса по платежам и фильтрацией по дате. " + TEST_STEP_MARKER)
  107.     public static void assertPaymentResponseContainsFilteredDateTo(
  108.             final String testCaseKey,
  109.             final Integer stepNumber,
  110.             final PaymentResponse paymentResponse,
  111.             final List<PaymentDto> dbPayments,
  112.             final Date dateTo) {
  113.  
  114.         paymentResponse.getDtos().forEach(payment -> assertThat(payment.getRegDateTime())
  115.                 .as("REGDATETIME платежа: %s должен быть до %s", payment.getRegDateTime(), dateTo)
  116.                 .isBefore(dateTo));
  117.  
  118.         assertListsOfServicePaymentsAndDbPayments(paymentResponse.getDtos(), dbPayments);
  119.     }
  120.  
  121.     @Step("Проверяем ответ от сервиса по платежам. " + TEST_STEP_MARKER)
  122.     public static void assertPaymentResponse(
  123.             final String testCaseKey,
  124.             final Integer stepNumber,
  125.             final PaymentResponse paymentResponse,
  126.             final List<PaymentDto> dbPayments
  127.     ) {
  128.  
  129.         SoftAssertions.assertSoftly(softly -> {
  130.             softly.assertThat(paymentResponse.getPageNum())
  131.                     .as(
  132.                             "В ответе от сервиса pagNum %s должен быть равен 0",
  133.                             paymentResponse.getPageNum()
  134.                     )
  135.                     .isEqualTo(0);
  136.  
  137.             softly.assertThat(paymentResponse.getTotalCount())
  138.                     .as(
  139.                             "В ответе от сервиса totalCount %s должен быть равен количеству записей в БД %s",
  140.                             paymentResponse.getTotalCount(),
  141.                             dbPayments.size()
  142.                     )
  143.                     .isEqualTo(dbPayments.size());
  144.  
  145.             if (paymentResponse.getTotalCount().intValue() >= 100) {
  146.                 softly.assertThat(paymentResponse.getFetchCount())
  147.                         .as(
  148.                                 "В ответе от сервиса fetchCount %s должен быть равен 100",
  149.                                 paymentResponse.getFetchCount()
  150.                         )
  151.                         .isEqualTo(100);
  152.  
  153.                 final int pageCount = paymentResponse.getTotalCount().intValue() / 100 + 1;
  154.  
  155.                 softly.assertThat(paymentResponse.getPageCount())
  156.                         .as(
  157.                                 "В ответе от сервиса pageCount %s должен быть равен %s",
  158.                                 paymentResponse.getPageCount(),
  159.                                 pageCount
  160.                         )
  161.                         .isEqualTo(pageCount);
  162.             } else {
  163.                 softly.assertThat(paymentResponse.getFetchCount())
  164.                         .as(
  165.                                 "В ответе от сервиса fetchCount %s должен быть равен количеству записей в БД %s",
  166.                                 paymentResponse.getFetchCount(),
  167.                                 dbPayments.size()
  168.                         )
  169.                         .isEqualTo(dbPayments.size());
  170.  
  171.                 softly.assertThat(paymentResponse.getPageCount())
  172.                         .as(
  173.                                 "В ответе от сервиса pageCount %s должен быть равен 1",
  174.                                 paymentResponse.getPageCount()
  175.                         )
  176.                         .isEqualTo(1);
  177.             }
  178.         });
  179.  
  180.         assertListsOfServicePaymentsAndDbPayments(paymentResponse.getDtos(), dbPayments);
  181.     }
  182.  
  183.     @Step("Сравниваем списки платежей из ответа от сервиса и из БД")
  184.     private static void assertListsOfServicePaymentsAndDbPayments(
  185.             final List<Payment> servicePayments,
  186.             final List<PaymentDto> dbPayments
  187.     ) {
  188.  
  189.         for (Payment payment : servicePayments) {
  190.             for (PaymentDto paymentDb : dbPayments) {
  191.                 if (paymentDb.getLocalSystemId().equals(payment.getId().getLocalSystemId()) &&
  192.                         payment.getId().getAppPkid().equals(paymentDb.getAppPkId())) {
  193.                     assertPaymentWithPaymentDto(payment, paymentDb);
  194.                     break;
  195.                 }
  196.             }
  197.         }
  198.  
  199. //        final List<PaymentDto> sortedDbPayments = sortPaymentDtoListByPaymentList(dbPayments, servicePayments);
  200. //
  201. //        if (sortedDbPayments.isEmpty()) {
  202. //            fail("В списках из БД и из ответа от сервиса не нашлось соответствий");
  203. //        }
  204. //
  205. //        if (servicePayments.size() == 1) {
  206. //            assertPaymentWithPaymentDto(servicePayments.get(0), sortedDbPayments.get(0));
  207. //        } else {
  208. //            for (int i = 0; i < servicePayments.size(); i++) {
  209. //                final Payment payment = servicePayments.get(i);
  210. //                final PaymentDto paymentDto = sortedDbPayments.get(i);
  211. //
  212. //                assertPaymentWithPaymentDto(payment, paymentDto);
  213. //            }
  214. //        }
  215.     }
  216.  
  217.     @Step("Сортируем список платежей")
  218.     private static List<PaymentDto> sortPaymentDtoListByPaymentList(List<PaymentDto> paymentDtos, List<Payment> payments) {
  219.         final List<PaymentDto> sortedList = new ArrayList<>();
  220.  
  221.         for (Payment payment : payments) {
  222.             for (PaymentDto paymentDto : paymentDtos) {
  223.                 if (paymentDto.getLocalSystemId().equals(payment.getId().getLocalSystemId()) &&
  224.                         payment.getId().getAppPkid().equals(paymentDto.getAppPkId())) {
  225.  
  226.                     LOGGER.info("!!!!!!! APPPKID db: " + paymentDto.getAppPkId() + " = service: " + payment.getId().getAppPkid() + " ? " + payment.getId().getAppPkid().equals(paymentDto.getAppPkId()));
  227.                     LOGGER.info("!!!!!!! LSID db: " + paymentDto.getLocalSystemId() + " = service: " + payment.getId().getLocalSystemId() + " ? " + paymentDto.getLocalSystemId().equals(payment.getId().getLocalSystemId()));
  228.                     sortedList.add(paymentDto);
  229.                 }
  230.             }
  231.         }
  232.  
  233. //        payments.forEach(payment -> paymentDtos.forEach(paymentDto -> {
  234. //            System.out.println("!!!!!!! APPPKID db: " + paymentDto.getAppPkId() + " = service: " + payment.getId().getAppPkid() + " ? " + payment.getId().getAppPkid().equals(paymentDto.getAppPkId()));
  235. //            System.out.println("!!!!!!! LSID db: " + paymentDto.getLocalSystemId() + " = service: " + payment.getId().getLocalSystemId() + " ? " + paymentDto.getLocalSystemId().equals(payment.getId().getLocalSystemId()));
  236. //
  237. //            if (paymentDto.getLocalSystemId().equals(payment.getId().getLocalSystemId()) &&
  238. //                    payment.getId().getAppPkid().equals(paymentDto.getAppPkId())) {
  239. //
  240. //                sortedList.add(paymentDto);
  241. //            }
  242. //        }));
  243.  
  244.         return sortedList;
  245.     }
  246.  
  247.     @Step("Сравниваем платеж из ответа от сервиса и из БД")
  248.     private static void assertPaymentWithPaymentDto(final Payment payment, final PaymentDto dbPayment) {
  249.         SoftAssertions.assertSoftly(softly -> {
  250.             softly.assertThat(payment.getId().getLocalSystemId())
  251.                     .as(
  252.                             "LOCAL_SYSTEM_ID от сервиса %s должен быть равен значению из БД %s",
  253.                             payment.getId().getLocalSystemId(),
  254.                             dbPayment.getLocalSystemId()
  255.                     )
  256.                     .isEqualTo(dbPayment.getLocalSystemId());
  257.  
  258.             softly.assertThat(payment.getApplicationName())
  259.                     .as(
  260.                             "APPLICATION_NAME от сервиса %s должен быть равен значению из БД %s",
  261.                             payment.getApplicationName(),
  262.                             dbPayment.getApplicationName()
  263.                     )
  264.                     .isEqualTo(dbPayment.getApplicationName());
  265.  
  266.             softly.assertThat(payment.getPersistDate())
  267.                     .as(
  268.                             "PERSIST_DATE от сервиса %s должен быть равен значению из БД %s",
  269.                             payment.getPersistDate(),
  270.                             dbPayment.getPersistDate()
  271.                     )
  272.                     .isEqualToIgnoringMillis(dbPayment.getPersistDate());
  273.  
  274.             softly.assertThat(payment.getTitle())
  275.                     .as(
  276.                             "TITLE от сервиса %s должен быть равен значению из БД %s",
  277.                             payment.getTitle(),
  278.                             dbPayment.getTitle()
  279.                     )
  280.                     .isEqualTo(dbPayment.getTitle());
  281.  
  282.             softly.assertThat(payment.getOwnerLogin())
  283.                     .as(
  284.                             "OWNER_LOGIN от сервиса %s должен быть равен значению из БД %s",
  285.                             payment.getOwnerLogin(),
  286.                             dbPayment.getOwnerLogin()
  287.                     )
  288.                     .isEqualTo(dbPayment.getOwnerLogin());
  289.  
  290.             softly.assertThat(payment.getAmount())
  291.                     .as(
  292.                             "AMOUNT от сервиса %s должен быть равен значению из БД %s",
  293.                             payment.getAmount(),
  294.                             dbPayment.getAmount()
  295.                     )
  296.                     .isEqualTo(dbPayment.getAmount());
  297.  
  298.             softly.assertThat(payment.getCashType())
  299.                     .as(
  300.                             "CASH_TYPE от сервиса %s должен быть равен значению из БД %s",
  301.                             payment.getCashType(),
  302.                             dbPayment.getCashType()
  303.                     )
  304.                     .isEqualTo(dbPayment.getCashType());
  305.  
  306.             softly.assertThat(payment.getNds())
  307.                     .as(
  308.                             "NDS от сервиса %s должен быть равен значению из БД %s",
  309.                             payment.getNds(),
  310.                             dbPayment.getNds()
  311.                     )
  312.                     .isEqualTo(dbPayment.getNds());
  313.  
  314.             softly.assertThat(payment.getChangeDate())
  315.                     .as(
  316.                             "CHANGE_DATE от сервиса %s должен быть равен значению из БД %s",
  317.                             payment.getChangeDate(),
  318.                             dbPayment.getChangeDate()
  319.                     )
  320.                     .isEqualToIgnoringMillis(dbPayment.getChangeDate());
  321.  
  322.             softly.assertThat(payment.getPaymentType())
  323.                     .as(
  324.                             "PAYMENT_TYPE от сервиса %s должен быть равен значению из БД %s",
  325.                             payment.getPaymentType(),
  326.                             dbPayment.getPaymentType()
  327.                     )
  328.                     .isEqualTo(dbPayment.getPaymentType());
  329.  
  330.             softly.assertThat(payment.getReason())
  331.                     .as(
  332.                             "REASON от сервиса %s должен быть равен значению из БД %s",
  333.                             payment.getReason(),
  334.                             dbPayment.getReason()
  335.                     )
  336.                     .isEqualTo(dbPayment.getReason());
  337.  
  338.             softly.assertThat(payment.getRegDateTime())
  339.                     .as(
  340.                             "REG_DATE_TIME от сервиса %s должен быть равен значению из БД %s",
  341.                             payment.getRegDateTime(),
  342.                             dbPayment.getRegDateTime()
  343.                     )
  344.                     .isEqualToIgnoringMillis(dbPayment.getRegDateTime());
  345.  
  346.             if (payment.getDeadline() == null) {
  347.                 softly.assertThat(payment.getDeadline())
  348.                         .as(
  349.                                 "Если DEADLINE от сервиса %s равен null значение из БД %s также должно быть null",
  350.                                 payment.getDeadline(),
  351.                                 dbPayment.getDeadline()
  352.                         )
  353.                         .isNull();
  354.             } else {
  355.                 softly.assertThat(payment.getDeadline())
  356.                         .as(
  357.                                 "DEADLINE от сервиса %s должен быть равен значению из БД %s",
  358.                                 payment.getDeadline(),
  359.                                 dbPayment.getDeadline()
  360.                         )
  361.                         .isEqualToIgnoringMillis(dbPayment.getDeadline());
  362.             }
  363.  
  364.             if (payment.getBillingPeriodAppPkId() == null) {
  365.                 softly.assertThat(dbPayment.getBillingPeriodAppPkId())
  366.                         .as(
  367.                                 "Если BILLING_PERIOD_APP_PKID от сервиса %s пустой, то в БД %s должен быть 0",
  368.                                 payment.getBillingPeriodAppPkId(),
  369.                                 dbPayment.getBillingPeriodAppPkId()
  370.                         )
  371.                         .isEqualTo(0);
  372.             } else {
  373.                 softly.assertThat(payment.getBillingPeriodAppPkId())
  374.                         .as(
  375.                                 "BILLING_PERIOD_APP_PKID от сервиса %s должен быть равен значению из БД %s",
  376.                                 payment.getBillingPeriodAppPkId(),
  377.                                 dbPayment.getBillingPeriodAppPkId()
  378.                         )
  379.                         .isEqualTo(dbPayment.getBillingPeriodAppPkId());
  380.             }
  381.  
  382.             softly.assertThat(payment.getBillingPeriodLocalSystemId())
  383.                     .as(
  384.                             "BILLING_PERIOD_LOCAL_SYSTEM_ID от сервиса %s должен быть равен значению из БД %s",
  385.                             payment.getBillingPeriodLocalSystemId(),
  386.                             dbPayment.getBillingPeriodLocalSystemId()
  387.                     )
  388.                     .isEqualTo(dbPayment.getBillingPeriodLocalSystemId());
  389.  
  390.             softly.assertThat(payment.getClientAppPkId())
  391.                     .as(
  392.                             "CLIENT_APP_PKID от сервиса %s должен быть равен значению из БД %s",
  393.                             payment.getClientAppPkId(),
  394.                             dbPayment.getClientAppPkId()
  395.                     )
  396.                     .isEqualTo(dbPayment.getClientAppPkId());
  397.  
  398.             softly.assertThat(payment.getClientLocalSystemId())
  399.                     .as(
  400.                             "CLIENT_LOCAL_SYSTEM_ID от сервиса %s должен быть равен значению из БД %s",
  401.                             payment.getClientLocalSystemId(),
  402.                             dbPayment.getClientLocalSystemId()
  403.                     )
  404.                     .isEqualTo(dbPayment.getClientLocalSystemId());
  405.  
  406.             if (payment.getPaymentOfficeAppPkId() == null) {
  407.                 softly.assertThat(dbPayment.getPaymentOfficeAppPkId())
  408.                         .as(
  409.                                 "Если PAYMENT_OFFICE_APP_PKID от сервиса %s пустой, то в БД %s должен быть 0",
  410.                                 payment.getPaymentOfficeAppPkId(),
  411.                                 dbPayment.getPaymentOfficeAppPkId()
  412.                         )
  413.                         .isEqualTo(0);
  414.             } else {
  415.                 softly.assertThat(payment.getPaymentOfficeAppPkId())
  416.                         .as(
  417.                                 "PAYMENT_OFFICE_APP_PKID от сервиса %s должен быть равен значению из БД %s",
  418.                                 payment.getPaymentOfficeAppPkId(),
  419.                                 dbPayment.getPaymentOfficeAppPkId()
  420.                         )
  421.                         .isEqualTo(dbPayment.getPaymentOfficeAppPkId());
  422.             }
  423.  
  424.             softly.assertThat(payment.getPaymentOfficeLocalSystemId())
  425.                     .as(
  426.                             "PAYMENT_OFFICE_LOCAL_SYSTEM_ID от сервиса %s должен быть равен значению из БД %s",
  427.                             payment.getPaymentOfficeLocalSystemId(),
  428.                             dbPayment.getPaymentOfficeLocalSystemId()
  429.                     )
  430.                     .isEqualTo(dbPayment.getPaymentOfficeLocalSystemId());
  431.  
  432.             if (payment.getPaymentOfficeVersion() == null) {
  433.                 softly.assertThat(dbPayment.getPaymentOfficeVersion())
  434.                         .as(
  435.                                 "Если PAYMENT_OFFICE_VERSION от сервиса %s пустой, то в БД %s должен быть 0",
  436.                                 payment.getPaymentOfficeVersion(),
  437.                                 dbPayment.getPaymentOfficeVersion()
  438.                         )
  439.                         .isEqualTo(0);
  440.             } else {
  441.                 softly.assertThat(payment.getPaymentOfficeVersion())
  442.                         .as(
  443.                                 "PAYMENT_OFFICE_VERSION от сервиса %s должен быть равен значению из БД %s",
  444.                                 payment.getPaymentOfficeVersion(),
  445.                                 dbPayment.getPaymentOfficeVersion()
  446.                         )
  447.                         .isEqualTo(dbPayment.getPaymentOfficeVersion());
  448.             }
  449.  
  450.             if (payment.getReferenceAppPkId() == null) {
  451.                 softly.assertThat(dbPayment.getReferenceAppPkId())
  452.                         .as(
  453.                                 "Если REFERENCE_APP_PKID от сервиса %s пустой, то в БД %s должен быть 0",
  454.                                 payment.getReferenceAppPkId(),
  455.                                 dbPayment.getReferenceAppPkId()
  456.                         )
  457.                         .isEqualTo(0);
  458.             } else {
  459.                 softly.assertThat(payment.getReferenceAppPkId())
  460.                         .as(
  461.                                 "REFERENCE_APP_PKID от сервиса %s должен быть равен значению из БД %s",
  462.                                 payment.getReferenceAppPkId(),
  463.                                 dbPayment.getReferenceAppPkId()
  464.                         )
  465.                         .isEqualTo(dbPayment.getReferenceAppPkId());
  466.             }
  467.  
  468.             softly.assertThat(payment.getReferenceLocalSystemId())
  469.                     .as(
  470.                             "REFERENCE_LOCAL_SYSTEM_ID от сервиса %s должен быть равен значению из БД %s",
  471.                             payment.getReferenceLocalSystemId(),
  472.                             dbPayment.getReferenceLocalSystemId()
  473.                     )
  474.                     .isEqualTo(dbPayment.getReferenceLocalSystemId());
  475.  
  476.  
  477.             if (payment.getServiceProviderAppPkId() == null) {
  478.                 softly.assertThat(dbPayment.getServiceProviderAppPkId())
  479.                         .as(
  480.                                 "Если SERVICE_PROVIDER_APP_PKID от сервиса %s пустой, то в БД %s должен быть 0",
  481.                                 payment.getServiceProviderAppPkId(),
  482.                                 dbPayment.getServiceProviderAppPkId()
  483.                         )
  484.                         .isEqualTo(0);
  485.             } else {
  486.                 softly.assertThat(payment.getServiceProviderAppPkId())
  487.                         .as(
  488.                                 "SERVICE_PROVIDER_APP_PKID от сервиса %s должен быть равен значению из БД %s",
  489.                                 payment.getServiceProviderAppPkId(),
  490.                                 dbPayment.getServiceProviderAppPkId()
  491.                         )
  492.                         .isEqualTo(dbPayment.getServiceProviderAppPkId());
  493.             }
  494.  
  495.             softly.assertThat(payment.getServiceProviderLocalSystemId())
  496.                     .as(
  497.                             "SERVICE_PROVIDER_LOCAL_SYSTEM_ID от сервиса %s должен быть равен значению из БД %s",
  498.                             payment.getServiceProviderLocalSystemId(),
  499.                             dbPayment.getServiceProviderLocalSystemId()
  500.                     )
  501.                     .isEqualTo(dbPayment.getServiceProviderLocalSystemId());
  502.  
  503.             if (payment.getServiceProviderVersion() == null) {
  504.                 softly.assertThat(dbPayment.getServiceProviderVersion())
  505.                         .as(
  506.                                 "Если SERVICE_PROVIDER_VERSION от сервиса %s пустой, то в БД %s должен быть 0",
  507.                                 payment.getServiceProviderVersion(),
  508.                                 dbPayment.getServiceProviderVersion()
  509.                         )
  510.                         .isEqualTo(0);
  511.             } else {
  512.                 softly.assertThat(payment.getServiceProviderVersion())
  513.                         .as(
  514.                                 "SERVICE_PROVIDER_VERSION от сервиса %s должен быть равен значению из БД %s",
  515.                                 payment.getServiceProviderVersion(),
  516.                                 dbPayment.getServiceProviderVersion()
  517.                         )
  518.                         .isEqualTo(dbPayment.getServiceProviderVersion());
  519.             }
  520.  
  521.             softly.assertThat(payment.getPenaltyAmount())
  522.                     .as(
  523.                             "PENALTY_AMOUNT от сервиса %s должен быть равен значению из БД %s",
  524.                             payment.getPenaltyAmount(),
  525.                             dbPayment.getPenaltyAmount()
  526.                     )
  527.                     .isEqualTo(dbPayment.getPenaltyAmount());
  528.  
  529.             softly.assertThat(payment.getPenaltyNds())
  530.                     .as(
  531.                             "PENALTY_NDS от сервиса %s должен быть равен значению из БД %s",
  532.                             payment.getPenaltyNds(),
  533.                             dbPayment.getPenaltyNds()
  534.                     )
  535.                     .isEqualTo(dbPayment.getPenaltyNds());
  536.  
  537.             if (payment.getCurrentVersion() == null) {
  538.                 softly.assertThat(dbPayment.getCurrentVersion())
  539.                         .as(
  540.                                 "Если CURRENT_VERSION от сервиса %s пустой, то в БД %s должен быть 0",
  541.                                 payment.getCurrentVersion(),
  542.                                 dbPayment.getCurrentVersion()
  543.                         )
  544.                         .isEqualTo(0);
  545.             } else {
  546.                 softly.assertThat(payment.getCurrentVersion())
  547.                         .as(
  548.                                 "CURRENT_VERSION от сервиса %s должен быть равен значению из БД %s",
  549.                                 payment.getCurrentVersion(),
  550.                                 dbPayment.getCurrentVersion()
  551.                         )
  552.                         .isEqualTo(dbPayment.getCurrentVersion());
  553.             }
  554.  
  555.             if (payment.getCustomerServiceAppPkId() == null) {
  556.                 softly.assertThat(dbPayment.getCustomerServiceAppPkId())
  557.                         .as(
  558.                                 "Если CUSTOMER_SERVICE_APP_PKID от сервиса %s пустой, то в БД %s должен быть 0",
  559.                                 payment.getCustomerServiceAppPkId(),
  560.                                 dbPayment.getCustomerServiceAppPkId()
  561.                         )
  562.                         .isEqualTo(0);
  563.             } else {
  564.                 softly.assertThat(payment.getCustomerServiceAppPkId())
  565.                         .as(
  566.                                 "CUSTOMER_SERVICE_APP_PKID от сервиса %s должен быть равен значению из БД %s",
  567.                                 payment.getCustomerServiceAppPkId(),
  568.                                 dbPayment.getCustomerServiceAppPkId()
  569.                         )
  570.                         .isEqualTo(dbPayment.getCustomerServiceAppPkId());
  571.             }
  572.  
  573.             softly.assertThat(payment.getCustomerServiceLocalSystemId())
  574.                     .as(
  575.                             "CUSTOMER_SERVICE_LOCAL_SYSTEM_ID от сервиса %s должен быть равен значению из БД %s",
  576.                             payment.getCustomerServiceLocalSystemId(),
  577.                             dbPayment.getCustomerServiceLocalSystemId()
  578.                     )
  579.                     .isEqualTo(dbPayment.getCustomerServiceLocalSystemId());
  580.  
  581.             if (payment.getCustomerServiceVersion() == null) {
  582.                 softly.assertThat(dbPayment.getCustomerServiceVersion())
  583.                         .as(
  584.                                 "Если CUSTOMER_SERVICE_VERSION от сервиса %s пустой, то в БД %s должен быть 0",
  585.                                 payment.getCustomerServiceVersion(),
  586.                                 dbPayment.getCustomerServiceVersion()
  587.                         )
  588.                         .isEqualTo(0);
  589.             } else {
  590.                 softly.assertThat(payment.getCustomerServiceVersion())
  591.                         .as(
  592.                                 "CUSTOMER_SERVICE_VERSION от сервиса %s должен быть равен значению из БД %s",
  593.                                 payment.getCustomerServiceVersion(),
  594.                                 dbPayment.getCustomerServiceVersion()
  595.                         )
  596.                         .isEqualTo(dbPayment.getCustomerServiceVersion());
  597.             }
  598.  
  599.             softly.assertThat(payment.getDType())
  600.                     .as(
  601.                             "D_TYPE от сервиса %s должен быть равен значению из БД %s",
  602.                             payment.getDType(),
  603.                             dbPayment.getDType()
  604.                     )
  605.                     .isEqualTo(dbPayment.getDType());
  606.         });
  607.     }
  608.  
  609. }
  610.  
Add Comment
Please, Sign In to add comment