{"id":371733,"date":"2024-05-21T04:55:33","date_gmt":"2024-05-21T04:55:33","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=371733"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T04:55:33","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=371733","title":{"rendered":"<span>\u041b\u043e\u0432\u0443\u0448\u043a\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Spring Boot<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u043c\u0438\u0440\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/509\/dea\/fe6\/509deafe6d5032b02c8022f9f27f793b.png\" width=\"512\" height=\"512\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/509\/dea\/fe6\/509deafe6d5032b02c8022f9f27f793b.png\"\/><\/figure>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u2014 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0438\u043f\u043e\u0442\u0435\u043a\u0430   <\/h2>\n<p>\u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c IT \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0442\u0430\u043b\u0430 \u043d\u043e\u0440\u043c\u043e\u0439. \u0423 \u043d\u0435\u0451 \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c, \u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0435\u0451 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u043f\u043e \u043c\u0435\u0440\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043a \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0448\u0438\u0440\u043d\u044b\u043c \u043f\u0440\u0438\u0451\u043c\u043e\u0447\u043d\u044b\u043c \u0442\u0435\u0441\u0442\u0430\u043c \u0438 \u0434\u0430\u043b\u0435\u0435. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043f\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044e \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0430 \u0446\u0435\u043d\u0430, \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0439 \u0441\u0442\u0443\u043f\u0435\u043d\u0438 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u0444\u0435\u043a\u0442\u0430 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/habr.com\/ru\/articles\/672484\/\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>, \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f: \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u2014 \u0434\u0435\u0448\u0451\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b, \u0438\u0445 \u043c\u043d\u043e\u0433\u043e, \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c\u0441\u044f, \u0442\u0435\u043c \u0432\u044b\u0448\u0435 \u0438 \u0434\u043e\u0440\u043e\u0436\u0435 \u0442\u0435\u0441\u0442\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0435\u043c \u0438\u0445 \u043c\u0435\u043d\u044c\u0448\u0435. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0438. \u0412\u0435\u0434\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041f\u041e \u043f\u043e\u0434\u043e\u0431\u043d\u044b \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0443, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0435\u043c\u0443 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430. \u041a\u0430\u043a \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435, \u043a\u0430\u043a \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u043c\u0435.<\/p>\n<p>\u0418 \u043a\u0441\u0442\u0430\u0442\u0438 \u043f\u0440\u043e \u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u044c: \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u0422\u0430\u043d\u043e\u0448\u043a\u0438\u043d, \u044f \u0432\u0435\u0434\u0443\u0449\u0438\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0426\u0438\u0430\u043d \u0441 2018 \u0433\u043e\u0434\u0430, \u043c\u043e\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u043c\u0430\u0440\u043a\u0435\u0442\u043f\u043b\u0435\u0439\u0441\u043e\u043c \u0438\u043f\u043e\u0442\u0435\u0447\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0442 \u0431\u0430\u043d\u043a\u043e\u0432 &#8212; \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0426\u0438\u0430\u043d.\u0418\u043f\u043e\u0442\u0435\u043a\u0430. \u041c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u0430 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0445 \u0438\u043f\u043e\u0442\u0435\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0430\u043d\u043a\u043e\u0432. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445, \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c\u0438, \u043a\u0430\u043a Java\/Kotlin\/Spring, PostgreSQL, Kafka, Kubernetes \u0438 \u042f\u043d\u0434\u0435\u043a\u0441.\u041e\u0431\u043b\u0430\u043a\u043e. \u0421 \u0440\u0435\u043b\u0438\u0437\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0436\u0435 \u043d\u0435\u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0438 \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0432\u043d\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u00ab\u043b\u043e\u0432\u0443\u0448\u0435\u043a\u00bb \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0432 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0445 \u0438 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445 \u043f\u0430\u0434\u0435\u043d\u0438\u044f\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u0440\u0430\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c\u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0443 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u0438\u0445 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u2014 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430.<\/p>\n<p>\u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044f \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441-\u043f\u0440\u0438\u043c\u0435\u0440 (CRUD API + \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0442\u0435\u043a Gradle\/Spring Boot\/Kotlin\/Postgres\/Kafka, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0443\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0421\u0435\u0440\u0432\u0438\u0441-\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u041f\u041e \u0441\u043b\u043e\u0451\u0432 \u2014 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b, \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430, \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043b\u0438\u0448\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0443 \u0438\u043b\u0438 \u0438\u043d\u0443\u044e \u043b\u043e\u0432\u0443\u0448\u043a\u0443, \u043f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/tanoshkin-cian\/integration-testing-pitfalls\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Spring, Junit 5 \u0438 testcontainers. \u0411\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u043b\u044e\u0441\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0435\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f: \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <em>@SpringBootTest<\/em> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0446\u0435\u043b\u043e\u043c (\u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0439 \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445), \u043e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e:\u00a0 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Convention_over_configuration\"><u>convention over configuration<\/u><\/a>, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0449\u0451 \u0438 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u044b\u0439 <a href=\"https:\/\/cloud.google.com\/migrate\/kf\/docs\/2.2\/how-to\/backing-services\"><u>backing service<\/u><\/a> \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0411\u0414 \u2014 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439: \u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043d\u0438\u0436\u0435 \u043c\u044b \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 \u0411\u0414 postgres \u0438 \u043f\u0440\u043e\u0441\u0438\u043c Spring Boot \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u044d\u0442\u043e\u0439 \u0411\u0414.<\/p>\n<pre><code>@Container @ServiceConnection var postgresContainer = PostgreSQLContainer(DockerImageName.parse(\"postgres:13\"))<\/code><\/pre>\n<pre><code>@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @Testcontainers class DirtyDbPitfall<\/code><\/pre>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0442\u0443 \u0438\u043b\u0438 \u0438\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u044f \u043f\u0435\u0440\u0435\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u041d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u0435\u0437 \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code>@TestMethodOrder(MethodOrderer.MethodName::class)<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f Java 21, Docker-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p><em>\u0417\u0430\u043f\u0443\u0441\u043a \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/em><\/p>\n<pre><code>.\/gradlew clean test<\/code><\/pre>\n<p><em>\u0413\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a (\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b)<\/em>   <\/p>\n<pre><code>.\/gradlew clean test --tests '*DirtyDbPitfall.createApiTest' BUILD SUCCESSFUL in 21s  .\/gradlew clean test --tests '*DirtyDbPitfall.removeApiTest' BUILD SUCCESSFUL in 21s  .\/gradlew clean test --tests '*DirtyDbPitfall'               DirtyDbPitfall > Removal API test FAILED     org.opentest4j.AssertionFailedError at DirtyDbPitfall.kt:79 BUILD FAILED in 21s<\/code><\/pre>\n<p>\u0421\u0438\u043c\u043f\u0442\u043e\u043c\u044b, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 <a href=\"https:\/\/vladislaveremeev.gitbook.io\/qa_bible\/avtomatizaciya-beta\/chto-takoe-flaky-tests\"><u>\u043c\u043e\u0440\u0433\u0430\u044e\u0449\u0438\u0445<\/u><\/a> \u0442\u0435\u0441\u0442\u0430\u0445, \u043b\u0438\u0431\u043e \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u0442\u0435\u0441\u0442\u0430, \u0431\u0443\u0434\u0443\u0447\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u2014 \u0437\u0435\u043b\u0451\u043d\u044b\u0435, \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u2014 \u043a\u0440\u0430\u0441\u043d\u0435\u044e\u0442.<\/p>\n<p>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043e\u0441\u043c\u043e\u0442\u0440\u0443 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u0441\u043e\u0431\u0440\u0430\u043b \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u043a\u0440\u0430\u0442\u043a\u043e\u0439 \u0432\u044b\u0436\u0438\u043c\u043a\u043e\u0439 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u043b\u043e\u0432\u0443\u0448\u043a\u0435, \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u0445 \u0435\u0451 \u043e\u0431\u0445\u043e\u0434\u0430 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445.<\/p>\n<h2>\u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043b\u043e\u0432\u0443\u0448\u0435\u043a<\/h2>\n<h3>\u0413\u0440\u044f\u0437\u043d\u0430\u044f \u0431\u0430\u0437\u0430 (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 DirtyDbPitfall.kt)  <\/h3>\n<p><strong>\u0421\u0443\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438<\/strong>: \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0441\u0442\u043e\u0432, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043e\u0434\u0438\u043d \u043d\u0430\u0431\u043e\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e @Test-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 Test-\u043a\u043b\u0430\u0441\u0441\u0430), \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 \u0447\u0435\u043c-\u0442\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u043c, \u0438\u043c\u0435\u044e\u0449\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0441\u0430\u043c\u043e\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u2014 \u0411\u0414), \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0435 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430.<\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f? <\/strong>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0432\u0430 \u0442\u0435\u0441\u0442\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0432\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0432\u0435\u0442\u043e\u043a \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e. \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043a\u0430\u043a \u043f\u0440\u0438 \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u0435, \u0442\u0430\u043a \u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u043e\u043d\u0438 \u0441\u0442\u0430\u043b\u0438 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u0438\u0437-\u0437\u0430 \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u00ab\u043f\u0440\u0435\u0442\u0435\u043d\u0437\u0438\u0439\u00bb \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440<\/strong><\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 API \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0447\u0442\u0435\u043d\u0438\u044f: \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f POST-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430:<\/p>\n<pre><code>@Test @DisplayName(\"Creation API test\") fun createApiTest() {    \/\/ given    val wantedEntitiesCount = 4     \/\/ when    val creationResponses = (1..4).map {        restClient.post().uri(\"\/persons\").body(mapOf(\"name\" to \"John Doe\")).retrieve().toBodilessEntity()    }    assertThat(creationResponses).allMatch { it.statusCode == HttpStatusCode.valueOf(200) }     \/\/ then    val businessEntities = restClient.get().uri(\"\/persons\").retrieve().body&lt;List&lt;Person>>()    assertThat(businessEntities?.size).isEqualTo(wantedEntitiesCount) }<\/code><\/pre>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u0442\u0435\u0441\u0442 \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 API \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043d\u043e \u0437\u0430\u0442\u0435\u043c \u0435\u0433\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043d\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c:<\/p>\n<pre><code>@Test @DisplayName(\"Removal API test\") fun removeApiTest() {    \/\/ given    val creationResponse =        restClient.post().uri(\"\/persons\").body(mapOf(\"name\" to \"John Doe\")).retrieve().toEntity&lt;Person>()    assertThat(creationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200))    val createdId = creationResponse.body?.id ?: fail { \"Created person ID could not be null\" }     \/\/ when    val removalResponse =        restClient.delete().uri(\"\/persons\/{createdId}\", createdId).retrieve().toBodilessEntity()    assertThat(removalResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200))     \/\/ then    val businessEntities = restClient.get().uri(\"\/persons\").retrieve().body&lt;List&lt;Person>>()    assertThat(businessEntities?.size).isEqualTo(0) }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043e\u0431\u0430 \u0442\u0435\u0441\u0442\u0430, \u0441\u0431\u043e\u0440\u043a\u0430 \u0443\u043f\u0430\u0434\u0435\u0442 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<pre><code>expected: 0  but was: 4 at java.base\/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) at java.base\/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) at tano.testingpitfalls.dirtydb.DirtyDbPitfall.removeApiTest(DirtyDbPitfall.kt:79)<\/code><\/pre>\n<p>\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u2014 \u0442\u0435\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0411\u0414, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u0443\u044e \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0438 \u043d\u0435 \u0447\u0438\u0441\u0442\u044f\u0442 \u0435\u0451 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2014 \u0432 \u0411\u0414 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432 (API \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f), \u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 API \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u041e\u0431\u0445\u043e\u0434<\/strong><\/p>\n<p>\u0427\u0438\u0441\u0442\u0438\u043c \u0411\u0414, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0445\u0443\u043a\u0438 JUnit (\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <em>@BeforeEach<\/em>). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f SystemUnderTest). \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/www.dolthub.com\/blog\/2022-11-03-soft-deletes\/\"><u>soft delete<\/u><\/a>) \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0430\u043c \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043e\u0442 \u0437\u0430\u043c\u0443\u0442\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0438. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0442\u0435\u0441\u0442\u0443 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u0430 \u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u0445 \u0436\u0435 \u0445\u0443\u043a\u043e\u0432 JUnit, \u043b\u0438\u0431\u043e \u044f\u0432\u043d\u043e \u2014 \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/73c\/127\/649\/73c127649b1f8c0ca55ea6a6803b887f.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u0413\u0440\u044f\u0437\u043d\u0430\u044f \u0431\u0430\u0437\u0430\u00bb\" title=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u0413\u0440\u044f\u0437\u043d\u0430\u044f \u0431\u0430\u0437\u0430\u00bb\" width=\"976\" height=\"831\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/73c\/127\/649\/73c127649b1f8c0ca55ea6a6803b887f.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u0413\u0440\u044f\u0437\u043d\u0430\u044f \u0431\u0430\u0437\u0430\u00bb<\/figcaption><\/div>\n<\/figure>\n<pre><code>@BeforeEach fun setUp() {     systemUnderTest.cleanDb() }<\/code><\/pre>\n<p><strong>\u0412\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u043d\u0430 \u0442\u0435\u043c\u0443 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/strong><\/p>\n<p>\u00ab\u0417\u0430\u0433\u0440\u044f\u0437\u043d\u044f\u0442\u044c\u0441\u044f\u00bb \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0411\u0414, \u043d\u043e \u0438 \u043b\u044e\u0431\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0436\u0438\u0437\u043d\u0438 \u043e\u0434\u0438\u043d \u0442\u0435\u0441\u0442. \u041e\u0431\u0449\u0438\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0442\u0443\u0442 \u0442\u043e\u0442 \u0436\u0435 \u2014 \u043e\u0447\u0438\u0449\u0430\u0442\u044c (\u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u043f\u043e \u043f\u0443\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430).<\/p>\n<h3>\u041d\u0435\u0436\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a (UnexpectedSchedulerPitfall.kt)<\/h3>\n<p><strong>\u0421\u0443\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438<\/strong>: \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0438\u043b\u0438 \u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u0441\u0442\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0435\u0433\u043e \u043d\u0435\u0447\u0442\u043e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430, \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u043c\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0432 \u0442\u0435\u0441\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c).<\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f? <\/strong>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u0442\u0430\u043b \u0432\u043b\u0438\u044f\u0442\u044c, \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0443 \u043d\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430..<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440<\/strong><\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441 LeadRemovalSchedulerService, \u043e\u043d \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d (\u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439) \u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u044b\u0439 (\u0440\u0430\u0437 \u0432 10 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434) \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code>class LeadRemovalSchedulerService(    private val personService: PersonService, ) {     private val logger = KotlinLogging.logger {}     @Scheduled(fixedRate = 10)    fun removeLeads() {        val count = personService.removeLeads()        if (count > 0) {            logger.info { \"Removed $count leads\" }        }    }  }<\/code><\/pre>\n<p>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0447\u0435\u0440\u0435\u0437 API \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0435\u0451 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<pre><code>@Test fun testModification() {    \/\/ given    val creationResponse =        restClient.post().uri(\"\/persons\").body(mapOf(\"name\" to \"John Doe\")).retrieve().toEntity&lt;Person>()    Assertions.assertThat(creationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200))    val createdId = creationResponse.body?.id ?: fail { \"Created person ID could not be null\" }     \/\/ when    val modificationResponse =        restClient.patch().uri(\"\/persons\/{createdId}\", createdId).body(mapOf(\"status\" to \"CLIENT\")).retrieve()            .toBodilessEntity()      \/\/ then    Assertions.assertThat(modificationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200)) }<\/code><\/pre>\n<p>\u041d\u043e \u043f\u0430\u0434\u0430\u0435\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043a\u0430 \u043e\u043d \u0434\u0435\u043b\u0430\u043b \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0443\u0434\u0430\u043b\u0438\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0411\u0414:<\/p>\n<pre><code>org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Internal Server Error: \"{\"timestamp\":\"2024-03-14T06:41:38.650+00:00\",\"status\":500,\"error\":\"Internal Server Error\",\"path\":\"\/persons\/1\"}\"  Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: tano.testingpitfalls.domain.IllegalInputDataException: No person with ID 1 found] with root cause  tano.testingpitfalls.domain.IllegalInputDataException: No person with ID 1 found at tano.testingpitfalls.service.PersonService.modifyPersonStatus(PersonService.kt:30)<\/code><\/pre>\n<p><strong>\u041e\u0431\u0445\u043e\u0434<\/strong><\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0435\u0433\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c (\u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0439 \u0442\u0435\u0441\u0442\u0430):<\/p>\n<pre><code>@Configuration @ConditionalOnProperty(prefix = \"scheduler\", name = [\"disabled\"], havingValue = \"false\", matchIfMissing = true) @EnableScheduling class SchedulerConfiguration<\/code><\/pre>\n<pre><code>@SpringBootTest(    webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,    properties = [\"scheduler.disabled=true\"] )<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430, \u043d\u0430 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b (\u0447\u0430\u0441\u0442\u043e\u0442\u0430, \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435) \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043f\u0440\u043e\u0447\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/48a\/c14\/6a9\/48ac146a99d990875561278adc1a8208.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435\u0436\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u00bb\" title=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435\u0436\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u00bb\" width=\"1301\" height=\"1049\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/48a\/c14\/6a9\/48ac146a99d990875561278adc1a8208.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435\u0436\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u00bb<\/figcaption><\/div>\n<\/figure>\n<h3>\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441?! (ClockPitfall.kt)<\/h3>\n<p><strong>\u0421\u0443\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438<\/strong>: \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0440\u0430\u0431\u043e\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0430\u0442\u044b \u0438\/\u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0442\u0435\u0441\u0442\u0430 \u044d\u0442\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f? <\/strong>\u0421\u0430\u043c\u044b\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u2014 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0439 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043a\u043e\u0435\u0433\u043e \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0435\u0433\u043e.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440<\/strong><\/p>\n<p>\u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435-\u043f\u0440\u0438\u043c\u0435\u0440\u0435 PATH API (<em>@PatchMapping(&#171;\/{personId}&#187;<\/em>) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0435 status \u0443 person, \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 (PersonService) \u044d\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u2014 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u043c\u044b \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0432 \u0411\u0414:<\/p>\n<pre><code>@Transactional fun modifyPersonStatus(personId: Long, newPersonStatus: PersonStatus): PersonEntity {    val personForModification = personEntityRepository.findByIdOrNull(id = personId) ?: throw IllegalInputDataException(\"No person with ID $personId found\")    personForModification.status = newPersonStatus    if (newPersonStatus == PersonStatus.CLIENT) {        val greetingSent = greetingService.greet(name = personForModification.name)        personForModification.greetingSent = greetingSent    }    return personForModification }<\/code><\/pre>\n<p>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e API, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f greetingMessageSent:<\/p>\n<pre><code>@Test fun testGreetings() {    \/\/ given    val creationResponse =        restClient.post().uri(\"\/persons\").body(mapOf(\"name\" to \"John Doe\")).retrieve().toEntity&lt;Person>()    assertThat(creationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200))    val createdId = creationResponse.body?.id ?: fail { \"Created person ID could not be null\" }     \/\/ when    val modificationResponse =        restClient.patch().uri(\"\/persons\/{createdId}\", createdId).body(mapOf(\"status\" to \"CLIENT\")).retrieve()            .toEntity&lt;Person>()    assertThat(modificationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200))      \/\/ then    assertThat(modificationResponse.body?.greetingMessageSent).isEqualTo(true) }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0433\u0434\u0435 \u0437\u0434\u0435\u0441\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0430, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 greet GreetingService\u0430: \u043b\u043e\u0433\u0438\u043a\u0430 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u2014 \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0442\u0430\u043b \u043d\u0430\u0448\u0438\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c, \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u043f\u043e\u0437\u0434\u0440\u0430\u0432\u0438\u0442\u044c, \u043e\u0442\u043e\u0441\u043b\u0430\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435:<\/p>\n<pre><code>fun greet(name: String): Boolean {    if (clock.workingHours()) {        \/\/ We will skip the sending logic itself for the sake of simplicity        logger.info { \"Greeting message for $name was sent successfully\" }        return true    } else {        logger.info { \"Greeting message for $name was not sent because it's not working hours\" }        return false    } }<\/code><\/pre>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0432\u0430\u0436\u043d\u043e\u0435 \u0437\u0434\u0435\u0441\u044c \u2014 \u0432\u044b\u0437\u043e\u0432 <em>clock.workingHours()<\/em>,<em> <\/em>\u044d\u0442\u043e \u043c\u0435\u0442\u043e\u0434-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u0440\u0435\u043c\u044f \u0438\u043b\u0438 \u043d\u0435\u0442:<\/p>\n<pre><code>fun Clock.workingHours(): Boolean {    val hour = this.instant().atZone(this.zone).hour    return hour in 9..18 }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0443\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d bean clock (<em>ClockConfiguration<\/em>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 GreetingService \u0434\u043b\u044f \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u2014 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u043d\u0435\u0442:<\/p>\n<pre><code>@Bean fun clock(): Clock {    \/\/ here in order to reproduce the clock pitfall we create fixed clock with nighttime    \/\/ however in real life we should use system default clock    val nightTime = ZonedDateTime.now().withHour(2).withMinute(0).withSecond(0).withNano(0)    return Clock.fixed(nightTime.toInstant(), ZoneId.systemDefault()) }<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u043b\u044f \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u0447\u0430\u0441\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 clock \u0432\u043e\u0432\u0441\u0435 \u043d\u0435\u0442 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435, \u043b\u0438\u0431\u043e \u043e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 TZ, \u043f\u0440\u0438\u043d\u044f\u0442\u043e\u0439 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0438\u043b\u0438 \u0436\u0435 \u0432 UTC.<\/p>\n<p><strong>\u041e\u0431\u0445\u043e\u0434<\/strong><\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0447\u0430\u0441\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f: \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 clock \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u043d\u0443\u0436\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 (<em>TestClockConfiguration.kt<\/em>):<\/p>\n<pre><code>@Bean @Primary fun workingHoursClock(): Clock {    val workingTime = ZonedDateTime.now().withHour(10).withMinute(0).withSecond(0).withNano(0)    return Clock.fixed(workingTime.toInstant(), ZoneId.systemDefault()) }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0447\u0430\u0441\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0435 \u0432\u0440\u0435\u043c\u044f. \u041d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0432 \u0442\u0435\u0441\u0442\u0430\u0445, \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0448\u0435\u043d\u0430:<\/p>\n<pre><code>@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @Testcontainers @ActiveProfiles(\"test\") @Import(TestClockConfiguration::class) class ClockPitfall<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f24\/d5f\/5ea\/f24d5f5ea409c60ae76c4cd24768132e.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441?!\u00bb\" title=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441?!\u00bb\" width=\"1026\" height=\"814\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f24\/d5f\/5ea\/f24d5f5ea409c60ae76c4cd24768132e.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441?!\u00bb<\/figcaption><\/div>\n<\/figure>\n<h3>\u041d\u0435 \u0434\u043e\u0436\u0434\u0430\u043b\u0438\u0441\u044c\u2026 (DidNotWaitPitfall.kt)  <\/h3>\n<p><strong>\u0421\u0443\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438<\/strong>: \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0435\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0435 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u043e\u043a\u0435\u0440\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (RMQ\/Kafka). \u0412 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u0440\u043e\u043a\u0435\u0440 (\u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043e\u043d\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430). \u0422\u0430\u043a \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439, \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c assertion \u0441\u0440\u0430\u0437\u0443, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c.<\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f? <\/strong>\u041b\u0435\u0433\u043a\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0443\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e assertion-\u0430 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u0441\u0442\u0430 (\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f), \u043d\u043e \u043f\u043e\u0437\u0436\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b, \u0438 \u0442\u0435\u0441\u0442\u044b \u0441\u0442\u0430\u043b\u0438 \u043f\u0430\u0434\u0430\u0442\u044c\/\u00ab\u043c\u043e\u0440\u0433\u0430\u0442\u044c\u00bb.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440<\/strong><\/p>\n<p>\u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435-\u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0435\u0441\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 LoyaltyProgramEnteredHandler:<\/p>\n<pre><code>@Service(EVENT_TYPE_LOYALTY_PROGRAM_ENTERED) class LoyaltyProgramEnteredHandler(    private val personService: PersonService ): EventHandler {     private val logger = KotlinLogging.logger {}    override fun handleEvent(event: Event) {        val personId = event.personId        val welcomeBonuses = personService.accrueWelcomeBonuses(personId = personId)        logger.info { \"Successfully handled event $event, added $welcomeBonuses\" }    } }<\/code><\/pre>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u043c-consumer-\u043e\u043c:<\/p>\n<pre><code>@Bean fun processEvents() = Consumer&lt;Event> {    eventDispatcher.processEvent(event = it) }<\/code><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437 topic-\u0430 Kafka (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Spring Cloud Stream + binder \u0434\u043b\u044f Kafka):<\/p>\n<pre><code>cloud:  function:    definition: processEvents  stream:    bindings:      processEvents-in-0:        group: ${spring.application.name}        destination: events<\/code><\/pre>\n<p>\u0412 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 binding, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0437 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f:<\/p>\n<pre><code>... spring:  cloud:    function:      definition: processEvents    stream:      bindings:        ...        events-out-0:          destination: events<\/code><\/pre>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u0442\u0435\u0441\u0442\u0435 (DidNotWaiPitfall.waitingPitfall) \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u043e\u0442 \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430.\u00a0<\/p>\n<p>\u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u0432\u0438\u0434 \u043d\u0435\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u043b\u044f, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<pre><code>val creationResponse =    restClient.post().uri(\"\/persons\").body(mapOf(\"name\" to \"John Doe\")).retrieve().toEntity&lt;Person>() assertThat(creationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200)) val createdId = creationResponse.body?.id ?: fail { \"Created person ID could not be null\" }  val modificationResponse =    restClient.patch().uri(\"\/persons\/{createdId}\", createdId).body(mapOf(\"status\" to \"CLIENT\")).retrieve()        .toEntity&lt;Person>() assertThat(modificationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200)) assertThat(modificationResponse.body?.bonusBalance).isEqualTo(0)<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (\u044f\u043a\u043e\u0431\u044b \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430) \u0432 Kafka, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f binding, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u043f\u0438\u0441\u0430\u043b \u0432\u044b\u0448\u0435:<\/p>\n<pre><code>fun sendEvent(eventType: String, userId: Long) {    streamBridge.send(\"events-out-0\", Event(personId = userId, type = eventType))<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442, \u0432\u044b\u0437\u044b\u0432\u0430\u044f GET API:<\/p>\n<pre><code>val resultingPerson = restClient.get().uri(\"\/persons\/{createdId}\", createdId).retrieve().toEntity&lt;Person>() assertThat(resultingPerson.body?.bonusBalance).isEqualTo(100)<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0435\u0441\u0442 \u043d\u0430\u0448 \u043f\u0430\u0434\u0430\u0435\u0442 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<pre><code>Expected :100L Actual   :0L  org.opentest4j.AssertionFailedError:  expected: 100L  but was: 0L<\/code><\/pre>\n<p><strong>\u041e\u0431\u0445\u043e\u0434<\/strong><\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u2014 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 assertion-\u0430, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043a\u0443, \u043f\u043e\u043a\u0430 \u0438\u0441\u0445\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e boilerplate-\u043a\u043e\u0434\u0430, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432\u0440\u043e\u0434\u0435 awaitility:<\/p>\n<pre><code>await untilAsserted {            val resultingPerson = restClient.get().uri(\"\/persons\/{createdId}\", createdId).retrieve().toEntity&lt;Person>()            assertThat(resultingPerson.body?.bonusBalance).isEqualTo(100) }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 GET API \u0434\u043e \u00ab\u043f\u043e\u0437\u0435\u043b\u0435\u043d\u0435\u043d\u0438\u044f\u00bb \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0438\u043b\u0438 \u0436\u0435 \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u0439\u043c-\u0430\u0443\u0442\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e4d\/8f7\/c4e\/e4d8f7c4eb5fb18580a2a0996a31156a.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435 \u0434\u043e\u0436\u0434\u0430\u043b\u0438\u0441\u044c\u00bb\" title=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435 \u0434\u043e\u0436\u0434\u0430\u043b\u0438\u0441\u044c\u00bb\" width=\"1012\" height=\"816\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e4d\/8f7\/c4e\/e4d8f7c4eb5fb18580a2a0996a31156a.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435 \u0434\u043e\u0436\u0434\u0430\u043b\u0438\u0441\u044c\u00bb<\/figcaption><\/div>\n<\/figure>\n<h3>\u041d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 (UnpredictablePitfall.kt)<\/h3>\n<p><strong>\u0421\u0443\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438<\/strong>: \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0432 \u0442\u0435\u0441\u0442\u0435 \u0436\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c. \u0412 \u043a\u0430\u043a\u043e\u043c-\u0442\u043e \u0441\u043c\u044b\u0441\u043b\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0447\u0430\u0441\u0430\u043c\u0438 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438 \u043a \u044d\u0442\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u043d\u043e \u0437\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u043e\u0431\u0445\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0438\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f? <\/strong>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 \u0442\u0435\u0441\u0442\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u043b\u0435, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 \u00ab\u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c\u00bb.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440<\/strong><\/p>\n<p>\u0412 integration-testing-pitfalls \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code>@Transactional fun confirmEmail(personId: Long, email: String): EmailInformation {    val foundPerson = personEntityRepository.findByIdOrNull(id = personId) ?: throw IllegalInputDataException(\"No person with ID $personId found\")    return foundPerson.emails.getOrElse(email) {        val confirmationId = confirmationIdGenerator.generateConfirmationId()        val emailInformation = EmailInformation(            email = email,            confirmationId = confirmationId,            isVerified = false        )        foundPerson.emails[email] = emailInformation        \/\/ We will skip the confirmation logic for now        return emailInformation    } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f confirmation ID:<\/p>\n<pre><code>fun generateConfirmationId() = UUID.randomUUID().toString()<\/code><\/pre>\n<p>\u0412 \u0442\u0435\u0441\u0442\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043f\u043e\u043b\u0435 confirmationCode, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430:<\/p>\n<pre><code>@Test fun testUnpredictable() {        \/\/ given        val creationResponse =            restClient.post().uri(\"\/persons\").body(mapOf(\"name\" to \"John Doe\")).retrieve().toEntity&lt;Person>()        Assertions.assertThat(creationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200))        val createdId = creationResponse.body?.id ?: fail { \"Created person ID could not be null\" }        val email = \"john@domain.com\"        val wantedConfirmationId = \"CONFIRMATION_ID\"         \/\/ when        val emailResponse =            restClient.post().uri(\"\/persons\/{createdId}\/email\", createdId).body(mapOf(\"email\" to email)).retrieve()                .toEntity&lt;EmailInfo>()          \/\/ then        Assertions.assertThat(emailResponse.body?.isVerified).isEqualTo(false)        Assertions.assertThat(emailResponse.body?.email).isEqualTo(email)        Assertions.assertThat(emailResponse.body?.confirmationCode).isEqualTo(wantedConfirmationId) }<\/code><\/pre>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441 \u0447\u0430\u0441\u0430\u043c\u0438 \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 bean, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439:<\/p>\n<pre><code>@MockkBean private lateinit var confirmationIdGenerator: ConfirmationIdGenerator<\/code><\/pre>\n<p>\u041f\u043b\u044e\u0441\u043e\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043c\u043e\u0449\u044c mock-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430:<\/p>\n<pre><code>every { confirmationIdGenerator.generateConfirmationId() } returns wantedConfirmationId<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/993\/186\/07b\/99318607bdb51b94f94f9226a6f101ed.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u00bb\" title=\"\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u00bb\" width=\"1006\" height=\"788\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/993\/186\/07b\/99318607bdb51b94f94f9226a6f101ed.png\"\/><\/p>\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u041d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u00bb<\/figcaption><\/div>\n<\/figure>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438. \u0422\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u043f\u0443\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438-\u043b\u043e\u0432\u0443\u0448\u043a\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u0432\u0430\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u043a\u0440\u0430\u0442\u043a\u0438\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043b\u043e\u0432\u0443\u0448\u0435\u043a \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0438\u0445 \u043e\u0431\u0445\u043e\u0434\u0430:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041b\u043e\u0432\u0443\u0448\u043a\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0421\u0443\u0442\u044c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041a\u0430\u043a \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0413\u0440\u044f\u0437\u043d\u0430\u044f \u0431\u0430\u0437\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0435 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u0441\u0442\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">@BeforeEach<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435\u0436\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0435\u0441\u0442\u044b \u0447\u0435\u0440\u0435\u0437 API \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u043a\u043b\u0438\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0438 \u043c\u0435\u043d\u044f\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0430 \u0442\u043e \u0438 \u0432\u043e\u0432\u0441\u0435 \u0435\u0451 \u0443\u0434\u0430\u043b\u044f\u0435\u0442, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u044b \u043f\u0430\u0434\u0430\u044e\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430: \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0441\u0430\u043c\u0443 \u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0435\u0433\u043e \u044f\u0432\u043d\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">@ActiveProfiles(&#171;test&#187;)  <\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0447\u0430\u0441?!<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 API, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0439 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438\/\u0434\u0430\u0442\u044b<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0447\u0430\u0441\u044b, \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0443, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432<\/p>\n<\/td>\n<td>\n<p align=\"left\">@TestConfiguration<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435 \u0434\u043e\u0436\u0434\u0430\u043b\u0438\u0441\u044c\u2026<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0415\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043c\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432 \u0442\u0435\u0441\u0442\u0435, \u043d\u0435 \u0437\u043d\u0430\u044f \u0442\u043e\u0447\u043d\u043e, \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432 \u0438\u043b\u0438 \u043d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430, \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0442\u043b\u044e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0441 \u0442\u0430\u0439\u043c-\u0430\u0443\u0442\u043e\u043c<\/p>\n<\/td>\n<td>\n<p align=\"left\">testImplementation(&#171;org.awaitility:awaitility-kotlin:4.2.1&#187;)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0435\u0441\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b), \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u043c\u0435\u043d\u044f\u044f \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c mock-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 API \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">@MockkBean<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h2>\u0427\u0442\u043e \u0435\u0449\u0451 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c\/\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u0442\u0435\u043c\u0435 <\/h2>\n<ul>\n<li>\n<p>\u041a\u043d\u0438\u0433\u0430 <a href=\"https:\/\/www.oreilly.com\/library\/view\/continuous-integration-improving\/9780321336385\/\"><u>Continuous Integration: Improving Software Quality and Reducing Risk<\/u><\/a><\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f <a href=\"https:\/\/www.baeldung.com\/spring-boot-testing-pitfalls\"><u>Pitfalls on Testing with Spring<\/u><\/a><\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f <a href=\"https:\/\/habr.com\/ru\/articles\/672484\/\"><u>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0443 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439. \u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u0432\u0430\u0441 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u2014 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u0441 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u0430\u0448\u0443 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443!  <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/802673\/\"> https:\/\/habr.com\/ru\/articles\/802673\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0447\u0430\u0441\u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u043c\u0438\u0440\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/p>\n<figure class=\"\"><\/figure>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u2014 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0438 \u0438\u043f\u043e\u0442\u0435\u043a\u0430   <\/h2>\n<p>\u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c IT \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0442\u0430\u043b\u0430 \u043d\u043e\u0440\u043c\u043e\u0439. \u0423 \u043d\u0435\u0451 \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u044c, \u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0435\u0451 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u0421\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u043f\u043e \u043c\u0435\u0440\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043a \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0448\u0438\u0440\u043d\u044b\u043c \u043f\u0440\u0438\u0451\u043c\u043e\u0447\u043d\u044b\u043c \u0442\u0435\u0441\u0442\u0430\u043c \u0438 \u0434\u0430\u043b\u0435\u0435. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043f\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044e \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0430 \u0446\u0435\u043d\u0430, \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0439 \u0441\u0442\u0443\u043f\u0435\u043d\u0438 \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u044b, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u0444\u0435\u043a\u0442\u0430 \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043f\u0438\u0440\u0430\u043c\u0438\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/habr.com\/ru\/articles\/672484\/\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>, \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f: \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u2014 \u0434\u0435\u0448\u0451\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b, \u0438\u0445 \u043c\u043d\u043e\u0433\u043e, \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c\u0441\u044f, \u0442\u0435\u043c \u0432\u044b\u0448\u0435 \u0438 \u0434\u043e\u0440\u043e\u0436\u0435 \u0442\u0435\u0441\u0442\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0435\u043c \u0438\u0445 \u043c\u0435\u043d\u044c\u0448\u0435. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0438\u043d\u0430\u0447\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0438. \u0412\u0435\u0434\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041f\u041e \u043f\u043e\u0434\u043e\u0431\u043d\u044b \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440\u0443, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0435\u043c\u0443 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430. \u041a\u0430\u043a \u0438\u043d\u0441\u043f\u0435\u043a\u0442\u043e\u0440, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u044e\u0442 \u0432\u043c\u0435\u0441\u0442\u0435, \u043a\u0430\u043a \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u043c\u0435.<\/p>\n<p>\u0418 \u043a\u0441\u0442\u0430\u0442\u0438 \u043f\u0440\u043e \u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u044c: \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u0422\u0430\u043d\u043e\u0448\u043a\u0438\u043d, \u044f \u0432\u0435\u0434\u0443\u0449\u0438\u0439 \u0438\u043d\u0436\u0435\u043d\u0435\u0440-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0426\u0438\u0430\u043d \u0441 2018 \u0433\u043e\u0434\u0430, \u043c\u043e\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u043c\u0430\u0440\u043a\u0435\u0442\u043f\u043b\u0435\u0439\u0441\u043e\u043c \u0438\u043f\u043e\u0442\u0435\u0447\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0442 \u0431\u0430\u043d\u043a\u043e\u0432 &#8212; \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0426\u0438\u0430\u043d.\u0418\u043f\u043e\u0442\u0435\u043a\u0430. \u041c\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u0430 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0445 \u0438\u043f\u043e\u0442\u0435\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0430\u043d\u043a\u043e\u0432. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445, \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c\u0438, \u043a\u0430\u043a Java\/Kotlin\/Spring, PostgreSQL, Kafka, Kubernetes \u0438 \u042f\u043d\u0434\u0435\u043a\u0441.\u041e\u0431\u043b\u0430\u043a\u043e. \u0421 \u0440\u0435\u043b\u0438\u0437\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0436\u0435 \u043d\u0435\u043c\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0438 \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u0432\u043d\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u00ab\u043b\u043e\u0432\u0443\u0448\u0435\u043a\u00bb \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0440\u0430\u0436\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0432 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0445 \u0438 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0445 \u043f\u0430\u0434\u0435\u043d\u0438\u044f\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u0440\u0430\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u043e. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c\u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0443 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u0438\u0445 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u2014 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430.<\/p>\n<p>\u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044f \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441-\u043f\u0440\u0438\u043c\u0435\u0440 (CRUD API + \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430), \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0442\u0435\u043a Gradle\/Spring Boot\/Kotlin\/Postgres\/Kafka, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0443\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0421\u0435\u0440\u0432\u0438\u0441-\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u041f\u041e \u0441\u043b\u043e\u0451\u0432 \u2014 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b, \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430, \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043b\u0438\u0448\u044c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0443 \u0438\u043b\u0438 \u0438\u043d\u0443\u044e \u043b\u043e\u0432\u0443\u0448\u043a\u0443, \u043f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/tanoshkin-cian\/integration-testing-pitfalls\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Spring, Junit 5 \u0438 testcontainers. \u0411\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u043b\u044e\u0441\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0435\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f: \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <em>@SpringBootTest<\/em> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0446\u0435\u043b\u043e\u043c (\u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0438\u0439 \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445), \u043e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e:\u00a0 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Convention_over_configuration\"><u>convention over configuration<\/u><\/a>, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0449\u0451 \u0438 \u044d\u043a\u0441\u043a\u043b\u044e\u0437\u0438\u0432\u043d\u044b\u0439 <a href=\"https:\/\/cloud.google.com\/migrate\/kf\/docs\/2.2\/how-to\/backing-services\"><u>backing service<\/u><\/a> \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0411\u0414 \u2014 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439: \u0432\u043e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043d\u0438\u0436\u0435 \u043c\u044b \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 \u0411\u0414 postgres \u0438 \u043f\u0440\u043e\u0441\u0438\u043c Spring Boot \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u044d\u0442\u043e\u0439 \u0411\u0414.<\/p>\n<pre><code>@Container @ServiceConnection var postgresContainer = PostgreSQLContainer(DockerImageName.parse(\"postgres:13\"))<\/code><\/pre>\n<pre><code>@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @Testcontainers class DirtyDbPitfall<\/code><\/pre>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0442\u0443 \u0438\u043b\u0438 \u0438\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u044f \u043f\u0435\u0440\u0435\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u041d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u0435\u0437 \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438:  <\/p>\n<pre><code>@TestMethodOrder(MethodOrderer.MethodName::class)<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f Java 21, Docker-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p><em>\u0417\u0430\u043f\u0443\u0441\u043a \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/em><\/p>\n<pre><code>.\/gradlew clean test<\/code><\/pre>\n<p><em>\u0413\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a (\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b)<\/em>   <\/p>\n<pre><code>.\/gradlew clean test --tests '*DirtyDbPitfall.createApiTest' BUILD SUCCESSFUL in 21s  .\/gradlew clean test --tests '*DirtyDbPitfall.removeApiTest' BUILD SUCCESSFUL in 21s  .\/gradlew clean test --tests '*DirtyDbPitfall'               DirtyDbPitfall > Removal API test FAILED     org.opentest4j.AssertionFailedError at DirtyDbPitfall.kt:79 BUILD FAILED in 21s<\/code><\/pre>\n<p>\u0421\u0438\u043c\u043f\u0442\u043e\u043c\u044b, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 <a href=\"https:\/\/vladislaveremeev.gitbook.io\/qa_bible\/avtomatizaciya-beta\/chto-takoe-flaky-tests\"><u>\u043c\u043e\u0440\u0433\u0430\u044e\u0449\u0438\u0445<\/u><\/a> \u0442\u0435\u0441\u0442\u0430\u0445, \u043b\u0438\u0431\u043e \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u0442\u0435\u0441\u0442\u0430, \u0431\u0443\u0434\u0443\u0447\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u2014 \u0437\u0435\u043b\u0451\u043d\u044b\u0435, \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u2014 \u043a\u0440\u0430\u0441\u043d\u0435\u044e\u0442.<\/p>\n<p>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u043e\u0441\u043c\u043e\u0442\u0440\u0443 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u0441\u043e\u0431\u0440\u0430\u043b \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u043a\u0440\u0430\u0442\u043a\u043e\u0439 \u0432\u044b\u0436\u0438\u043c\u043a\u043e\u0439 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u043b\u043e\u0432\u0443\u0448\u043a\u0435, \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u0445 \u0435\u0451 \u043e\u0431\u0445\u043e\u0434\u0430 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445.<\/p>\n<h2>\u041a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043b\u043e\u0432\u0443\u0448\u0435\u043a<\/h2>\n<h3>\u0413\u0440\u044f\u0437\u043d\u0430\u044f \u0431\u0430\u0437\u0430 (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 DirtyDbPitfall.kt)  <\/h3>\n<p><strong>\u0421\u0443\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438<\/strong>: \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0441\u0442\u043e\u0432, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043e\u0434\u0438\u043d \u043d\u0430\u0431\u043e\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e @Test-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 Test-\u043a\u043b\u0430\u0441\u0441\u0430), \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441 \u0447\u0435\u043c-\u0442\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u043c, \u0438\u043c\u0435\u044e\u0449\u0438\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0441\u0430\u043c\u043e\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u2014 \u0411\u0414), \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0435 \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430.<\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f? <\/strong>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0432\u0430 \u0442\u0435\u0441\u0442\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0432\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0434\u0432\u0443\u0445 \u0432\u0435\u0442\u043e\u043a \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e. \u041f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u043a\u0430\u043a \u043f\u0440\u0438 \u0438\u043d\u0434\u0438\u0432\u0438\u0434\u0443\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u0435, \u0442\u0430\u043a \u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u043e\u043d\u0438 \u0441\u0442\u0430\u043b\u0438 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u0438\u0437-\u0437\u0430 \u0432\u0437\u0430\u0438\u043c\u043d\u044b\u0445 \u00ab\u043f\u0440\u0435\u0442\u0435\u043d\u0437\u0438\u0439\u00bb \u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440<\/strong><\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 API \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0447\u0442\u0435\u043d\u0438\u044f: \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f POST-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430:<\/p>\n<pre><code>@Test @DisplayName(\"Creation API test\") fun createApiTest() {    \/\/ given    val wantedEntitiesCount = 4     \/\/ when    val creationResponses = (1..4).map {        restClient.post().uri(\"\/persons\").body(mapOf(\"name\" to \"John Doe\")).retrieve().toBodilessEntity()    }    assertThat(creationResponses).allMatch { it.statusCode == HttpStatusCode.valueOf(200) }     \/\/ then    val businessEntities = restClient.get().uri(\"\/persons\").retrieve().body&lt;List&lt;Person>>()    assertThat(businessEntities?.size).isEqualTo(wantedEntitiesCount) }<\/code><\/pre>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u0442\u0435\u0441\u0442 \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 API \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043d\u043e \u0437\u0430\u0442\u0435\u043c \u0435\u0433\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043d\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c:<\/p>\n<pre><code>@Test @DisplayName(\"Removal API test\") fun removeApiTest() {    \/\/ given    val creationResponse =        restClient.post().uri(\"\/persons\").body(mapOf(\"name\" to \"John Doe\")).retrieve().toEntity&lt;Person>()    assertThat(creationResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200))    val createdId = creationResponse.body?.id ?: fail { \"Created person ID could not be null\" }     \/\/ when    val removalResponse =        restClient.delete().uri(\"\/persons\/{createdId}\", createdId).retrieve().toBodilessEntity()    assertThat(removalResponse.statusCode).isEqualTo(HttpStatusCode.valueOf(200))     \/\/ then    val businessEntities = restClient.get().uri(\"\/persons\").retrieve().body&lt;List&lt;Person>>()    assertThat(businessEntities?.size).isEqualTo(0) }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043e\u0431\u0430 \u0442\u0435\u0441\u0442\u0430, \u0441\u0431\u043e\u0440\u043a\u0430 \u0443\u043f\u0430\u0434\u0435\u0442 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<pre><code>expected: 0  but was: 4 at java.base\/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) at java.base\/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) at tano.testingpitfalls.dirtydb.DirtyDbPitfall.removeApiTest(DirtyDbPitfall.kt:79)<\/code><\/pre>\n<p>\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u2014 \u0442\u0435\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u0411\u0414, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u0443\u044e \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0438 \u043d\u0435 \u0447\u0438\u0441\u0442\u044f\u0442 \u0435\u0451 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2014 \u0432 \u0411\u0414 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432 (API \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f), \u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 API \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u041e\u0431\u0445\u043e\u0434<\/strong><\/p>\n<p>\u0427\u0438\u0441\u0442\u0438\u043c \u0411\u0414, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0445\u0443\u043a\u0438 JUnit (\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f <em>@BeforeEach<\/em>). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u043d \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f SystemUnderTest). \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <a href=\"https:\/\/www.dolthub.com\/blog\/2022-11-03-soft-deletes\/\"><u>soft delete<\/u><\/a>) \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0430\u043c \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043e\u0442 \u0437\u0430\u043c\u0443\u0442\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0438. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0442\u0435\u0441\u0442\u0443 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u0430 \u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u0445 \u0436\u0435 \u0445\u0443\u043a\u043e\u0432 JUnit, \u043b\u0438\u0431\u043e \u044f\u0432\u043d\u043e \u2014 \u043f\u0440\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0435 \u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0432 \u0441\u0430\u043c\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435).<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u0445\u0435\u043c\u0430 \u043e\u0431\u0445\u043e\u0434\u0430 \u043b\u043e\u0432\u0443\u0448\u043a\u0438 \u00ab\u0413\u0440\u044f\u0437\u043d\u0430\u044f \u0431\u0430\u0437\u0430\u00bb<\/figcaption><\/div>\n<\/figure>\n<pre><code>@BeforeEach fun setUp() {     systemUnderTest.cleanDb() }<\/code><\/pre>\n<p><strong>\u0412\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u043d\u0430 \u0442\u0435\u043c\u0443 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/strong><\/p>\n<p>\u00ab\u0417\u0430\u0433\u0440\u044f\u0437\u043d\u044f\u0442\u044c\u0441\u044f\u00bb \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0411\u0414, \u043d\u043e \u0438 \u043b\u044e\u0431\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0436\u0438\u0437\u043d\u0438 \u043e\u0434\u0438\u043d \u0442\u0435\u0441\u0442. \u041e\u0431\u0449\u0438\u0439 \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0442\u0443\u0442 \u0442\u043e\u0442 \u0436\u0435 \u2014 \u043e\u0447\u0438\u0449\u0430\u0442\u044c (\u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u043f\u043e \u043f\u0443\u0442\u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430).<\/p>\n<h3>\u041d\u0435\u0436\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a (UnexpectedSchedulerPitfall.kt)<\/h3>\n<p><strong>\u0421\u0443\u0442\u044c \u043b\u043e\u0432\u0443\u0448\u043a\u0438<\/strong>: \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0438\u043b\u0438 \u0441 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u043e\u0442\u043e\u0439. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u0441\u0442\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0435\u0433\u043e \u043d\u0435\u0447\u0442\u043e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0435 \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430, \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u043c\u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0432 \u0442\u0435\u0441\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c).<\/p>\n<p><strong>\u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f? <\/strong>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u0442\u0430\u043b \u0432\u043b\u0438\u044f\u0442\u044c, \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0443 \u043d\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430..<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440<\/strong><\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441 LeadRemovalSchedulerService, \u043e\u043d \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d (\u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439) \u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u044b\u0439 (\u0440\u0430\u0437 \u0432 10 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434) \u0437\u0430\u043f\u0443\u0441\u043a:<\/p>\n<pre><code>class LeadRemovalSchedulerService(    private val personService: PersonService, ) {     private val logger =<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-371733","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=371733"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371733\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=371733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=371733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=371733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}