{"pageProps":{"post":{"mdxSource":"var Component=(()=>{var p=Object.create;var t=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var o=a=>t(a,\"__esModule\",{value:!0});var N=(a,s)=>()=>(s||a((s={exports:{}}).exports,s),s.exports),k=(a,s)=>{o(a);for(var c in s)t(a,c,{get:s[c],enumerable:!0})},g=(a,s,c)=>{if(s&&typeof s==\"object\"||typeof s==\"function\")for(let e of m(s))!u.call(a,e)&&e!==\"default\"&&t(a,e,{get:()=>s[e],enumerable:!(c=d(s,e))||c.enumerable});return a},y=a=>g(o(t(a!=null?p(h(a)):{},\"default\",a&&a.__esModule&&\"default\"in a?{get:()=>a.default,enumerable:!0}:{value:a,enumerable:!0})),a);var r=N((C,i)=>{i.exports=_jsx_runtime});var I={};k(I,{default:()=>v,frontmatter:()=>f});var n=y(r()),f={title:\"How to Test Your Microservices with Spring Cloud Contracts\",heading:\"How to Test Your Microservices with Spring Cloud Contracts\",date:\"2023-07-01\",tags:[\"contract-testing\"],draft:!1,summary:\"Explore the advantages of contract testing with Spring Boot Cloud Contract testing framework. Learn through practical examples in this blog on how and why to use Spring Cloud Contracts for effective contract testing.\",authors:[\"usmanakhtar\"],repoName:\"/tree/main/How%20to%20Test%20Your%20Microservices%20with%20Spring%20Cloud%20Contracts\",newsletterActionText:\"Boost your testing skills with the latest methods and tools, keeping your code robust and ready for success\"};function w(a={}){let{wrapper:s}=a.components||{};return s?(0,n.jsx)(s,Object.assign({},a,{children:(0,n.jsx)(c,{})})):c();function c(){let e=Object.assign({div:\"div\",h2:\"h2\",a:\"a\",span:\"span\",p:\"p\",blockquote:\"blockquote\",h3:\"h3\",pre:\"pre\",code:\"code\",strong:\"strong\"},a.components),{Image:l}=e;return l||b(\"Image\",!0),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(\"div\",{className:\"w-full pt-10\",children:(0,n.jsx)(e.div,{children:(0,n.jsx)(l,{alt:\"spring-cloud-header\",src:\"/static/images/testing/featured/spring-cloud-contract-testing.png\",width:\"808\",height:\"278\"})})}),(0,n.jsxs)(e.h2,{id:\"contract-testing\",children:[(0,n.jsx)(e.a,{href:\"#contract-testing\",\"aria-hidden\":\"true\",tabIndex:\"-1\",children:(0,n.jsx)(e.span,{className:\"icon icon-link\"})}),\"Contract Testing\"]}),(0,n.jsx)(e.p,{children:\"Contract testing is a method of testing software systems that focuses on the interactions between different microservices or components within a larger system. The goal of contract testing is to ensure that each microservice or component meets its expected behavior and obligations according to a predefined set of expectations, which are typically documented in a contract.\"}),(0,n.jsx)(e.blockquote,{children:(0,n.jsxs)(e.p,{children:[\"If you want to read more about contract testing read an article \",(0,n.jsx)(e.a,{href:\"https://codecrust.com/blog/testing/contract-testing\",children:\"Contract Testing: Importance in Micro services Ecosystem\"}),\" which takes more in-depth approach to it.\"]})}),(0,n.jsxs)(e.h2,{id:\"spring-cloud-contracts\",children:[(0,n.jsx)(e.a,{href:\"#spring-cloud-contracts\",\"aria-hidden\":\"true\",tabIndex:\"-1\",children:(0,n.jsx)(e.span,{className:\"icon icon-link\"})}),\"Spring Cloud Contracts\"]}),(0,n.jsx)(e.p,{children:\"Spring Cloud Contracts is a framework that provides a convenient way for Java developers to perform contract testing in their Spring Boot applications. By leveraging Spring Cloud Contracts, development teams can define contracts that outline the expected behavior of their services, and then generate test cases automatically based on those contracts. This eliminates the need for developers to manually create test cases, reducing the time and effort required to perform thorough testing.\"}),(0,n.jsxs)(e.h2,{id:\"implementation\",children:[(0,n.jsx)(e.a,{href:\"#implementation\",\"aria-hidden\":\"true\",tabIndex:\"-1\",children:(0,n.jsx)(e.span,{className:\"icon icon-link\"})}),\"Implementation\"]}),(0,n.jsx)(e.p,{children:\"Let's consider a simple example to grasp the workings of Spring Cloud. We have two services: employee-service and department-service. The employee-service has an endpoint that retrieves employee details, including the department they belong to. To obtain the department information, the employee-service interacts with the department-service.\"}),(0,n.jsx)(\"div\",{className:\"w-full\",children:(0,n.jsx)(e.div,{children:(0,n.jsx)(l,{alt:\"spring-cloud-example\",src:\"/static/images/testing/diagrams/spring-cloud-contract-testing.png\",width:\"808\",height:\"278\"})})}),(0,n.jsxs)(e.h2,{id:\"producer\",children:[(0,n.jsx)(e.a,{href:\"#producer\",\"aria-hidden\":\"true\",tabIndex:\"-1\",children:(0,n.jsx)(e.span,{className:\"icon icon-link\"})}),\"Producer\"]}),(0,n.jsx)(e.p,{children:\"In contract testing, the producer (also known as the provider) is responsible for creating and exposing an API while defining the API contract. In the case of our example, the department-service is currently functioning as the producer. Now, let's delve into the process of creating it.\"}),(0,n.jsxs)(e.h3,{id:\"department-service\",children:[(0,n.jsx)(e.a,{href:\"#department-service\",\"aria-hidden\":\"true\",tabIndex:\"-1\",children:(0,n.jsx)(e.span,{className:\"icon icon-link\"})}),\"Department Service\"]}),(0,n.jsx)(e.p,{children:\"Begin by creating an empty Maven project and incorporating the following dependencies into it.\"}),(0,n.jsx)(e.pre,{className:\"language-xml\",children:(0,n.jsxs)(e.code,{className:\"code-highlight language-xml\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token comment\",children:\"\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.springframework.cloud\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring-cloud-starter-contract-verifier\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"scope\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"test\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.springframework.boot\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring-boot-starter-web\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"com.fasterxml.jackson.module\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"jackson-module-kotlin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.jetbrains.kotlin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"kotlin-reflect\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.jetbrains.kotlin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"kotlin-stdlib-jdk8\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.projectlombok\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"lombok\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"optional\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"true\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.springframework.boot\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring-boot-starter-test\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"scope\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"test\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Next, let's add these plugins as well. In particular, note that the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"baseClassForTests\"})}),\" plugin includes the path to the BaseClass that configures the contract test. We will explore this further in the subsequent steps.\"]}),(0,n.jsx)(e.pre,{className:\"language-xml\",children:(0,n.jsxs)(e.code,{className:\"code-highlight language-xml\",children:[(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\",(0,n.jsx)(e.span,{className:\"token comment\",children:\"\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"plugin\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.springframework.cloud\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring-cloud-contract-maven-plugin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"version\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"3.1.7\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"extensions\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"true\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"configuration\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"testFramework\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"JUNIT5\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"baseClassForTests\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"com.codecrust.department.BaseClass\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"plugin\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.springframework.boot\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring-boot-maven-plugin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"configuration\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"excludes\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"exclude\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.projectlombok\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"lombok\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"plugin\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.jetbrains.kotlin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"kotlin-maven-plugin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"configuration\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"args\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"arg\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"-Xjsr305=strict\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"compilerPlugins\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"plugin\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependencies\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.jetbrains.kotlin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"kotlin-maven-allopen\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"version\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"${kotlin.version}\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Let's proceed by creating a basic model called \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"DepartmentResponse\"})}),\".\"]}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"data\"}),\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"DepartmentResponse\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" id\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" name\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),` String\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Now let's create a simple service class called \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"DepartmentService\"})}),\".\"]}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" com\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"codecrust\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"department\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"models\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`DepartmentResponse\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"stereotype\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`Service\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@Service\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" DepartmentService \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"fun\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"getDepartmentByEmployeeId\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),\"employeeId\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" DepartmentResponse \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"return\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"DepartmentResponse\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" id \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" \",(0,n.jsx)(e.span,{className:\"token string\",children:'\"department-1\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" name \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" \",(0,n.jsx)(e.span,{className:\"token string\",children:'\"Sales\"'}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]})]})}),(0,n.jsx)(e.p,{children:\"Afterwards, let's create a simple controller that will handle the retrieval of department details.\"}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" com\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"codecrust\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"department\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"models\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`DepartmentResponse\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" com\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"codecrust\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"department\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"services\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`DepartmentService\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"bind\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"annotation\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`GetMapping\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"bind\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"annotation\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`PathVariable\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"bind\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"annotation\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`RestController\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@RestController\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"DepartmentController\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" service\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" DepartmentService\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@GetMapping\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token string\",children:'\"/department/{employeeId}\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"fun\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"getDepartmentByEmployeeId\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@PathVariable\"}),\" employeeId\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" DepartmentResponse\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"return\"}),\" service\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"getDepartmentByEmployeeId\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),\"employeeId\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Now, let's create a \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"BaseClass\"})}),\" to configure the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"DepartmentController\"})}),\" for contract testing.\"]}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" com\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"codecrust\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"department\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"controllers\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`DepartmentController\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" io\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"restassured\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"module\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"mockmvc\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`RestAssuredMockMvc\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"junit\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"jupiter\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"api\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`BeforeEach\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"beans\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"factory\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"annotation\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`Autowired\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"boot\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"test\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"context\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`SpringBootTest\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@SpringBootTest\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),\"classes \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"[\"}),\"DepartmentApplication\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"::\"}),(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"]\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"abstract\"}),\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" BaseClass \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@Autowired\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"var\"}),\" departmentController\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" DepartmentController\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"?\"}),\" \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"null\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@BeforeEach\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"fun\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"setup\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" RestAssuredMockMvc\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"standaloneSetup\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),\"departmentController\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Next, add a Groovy file in the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"resources/contracts\"})}),\" directory to define the contract for the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"/department/{employee-id}\"})}),\" endpoint.\"]}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"cloud\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"contract\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"spec\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`Contract\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"Contract\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"make\"}),\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"description \",(0,n.jsx)(e.span,{className:\"token string\",children:'\"should return sales department by employeeId employee-1\"'}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"request \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"url \",(0,n.jsx)(e.span,{className:\"token string\",children:'\"/department/employee-1\"'}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"method \",(0,n.jsx)(e.span,{className:\"token function\",children:\"GET\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"response \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\t\tstatus \",(0,n.jsx)(e.span,{className:\"token function\",children:\"OK\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\t\theaders\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\t\t\tcontentType \",(0,n.jsx)(e.span,{className:\"token function\",children:\"applicationJson\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\t\t\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\t\t\",(0,n.jsx)(e.span,{className:\"token function\",children:\"body\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\t\t\tid\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" \",(0,n.jsx)(e.span,{className:\"token string\",children:'\"department-1\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\t\t\tname\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" \",(0,n.jsx)(e.span,{className:\"token string\",children:'\"Sales\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\"\t\t\t\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Now, when we install the Maven project using a command like \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"mvn clean compile install\"})}),\", it will automatically generate the test class for us inside the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"target/generated-test-sources/contracts\"})}),\" directory. With this, we have completed the configuration of the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"department-service\"})}),\" as the producer. Now, we can proceed to create the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"employee-service\"})}),\", which will consume the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"/department/{employeeId}\"})}),\" endpoint.\"]}),(0,n.jsxs)(e.h2,{id:\"consumer\",children:[(0,n.jsx)(e.a,{href:\"#consumer\",\"aria-hidden\":\"true\",tabIndex:\"-1\",children:(0,n.jsx)(e.span,{className:\"icon icon-link\"})}),\"Consumer\"]}),(0,n.jsxs)(e.p,{children:[\"In the terms of contract testing, the consumer is the entity or system that utilizes the API exposed by the producer and tests its implementation against the provided contract or specification. In our specific case, the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"employee-service\"})}),\" will serve as the consumer. Now, let's commence the creation of the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"employee-service\"})}),\".\"]}),(0,n.jsxs)(e.h3,{id:\"employee-service\",children:[(0,n.jsx)(e.a,{href:\"#employee-service\",\"aria-hidden\":\"true\",tabIndex:\"-1\",children:(0,n.jsx)(e.span,{className:\"icon icon-link\"})}),\"Employee Service\"]}),(0,n.jsx)(e.p,{children:\"To begin, create an empty Maven project and incorporate the following dependencies into it:\"}),(0,n.jsx)(e.pre,{className:\"language-xml\",children:(0,n.jsxs)(e.code,{className:\"code-highlight language-xml\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token comment\",children:\"\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.springframework.cloud\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring-cloud-starter-contract-stub-runner\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"scope\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"test\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.springframework.boot\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring-boot-starter-web\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"com.fasterxml.jackson.module\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"jackson-module-kotlin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.jetbrains.kotlin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"kotlin-reflect\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.jetbrains.kotlin\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"kotlin-stdlib-jdk8\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"dependency\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"groupId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"org.springframework.boot\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"artifactId\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"spring-boot-starter-test\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"<\"}),\"scope\"]}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\">\"})]}),\"test\",(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsxs)(e.span,{className:\"token tag\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"\"})]}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Next, let's create two models: \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"DepartmentResponse\"})}),\" and \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"EmployeeResponse\"})}),\".\"]}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"data\"}),\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"DepartmentResponse\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" id\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" name\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),` String\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"data\"}),\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"EmployeeResponse\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" id\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" name\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" department\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"?\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Now, let's create a basic \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"EmployeeService\"})}),\" class.\"]}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" com\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"codecrust\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"employee\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"models\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`DepartmentResponse\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" com\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"codecrust\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"employee\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"models\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`EmployeeResponse\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"http\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`HttpEntity\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"http\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`HttpHeaders\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"http\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`HttpMethod\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"http\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`ResponseEntity\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"stereotype\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`Service\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"client\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`RestTemplate\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@Service\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"EmployeeService\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" restTemplate\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" RestTemplate\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"fun\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"getEmployeeById\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),\"id\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" EmployeeResponse \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" httpHeaders \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"HttpHeaders\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" httpHeaders\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"add\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token string\",children:'\"Content-Type\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),\" \",(0,n.jsx)(e.span,{className:\"token string\",children:'\"application/json\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" requestEntity \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" HttpEntity\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"<\"}),\"Void\",(0,n.jsx)(e.span,{className:\"token operator\",children:\">\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),\"httpHeaders\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" responseEntity\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" ResponseEntity\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"<\"}),\"DepartmentResponse\",(0,n.jsx)(e.span,{className:\"token operator\",children:\">\"}),\" \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" restTemplate\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"exchange\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsxs)(e.span,{className:\"token string\",children:['\"http://localhost:8080/department/',(0,n.jsx)(e.span,{className:\"token interpolation variable\",children:\"$id\"}),'\"']}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" HttpMethod\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"GET\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" requestEntity\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" DepartmentResponse\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"::\"}),(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`java\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"return\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"EmployeeResponse\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" id\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),(0,n.jsx)(e.span,{className:\"token string\",children:'\"employee-id\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" name \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" \",(0,n.jsx)(e.span,{className:\"token string\",children:'\"John\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" department \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" responseEntity\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"body\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"!!\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`name\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Afterward, let's create a simple controller for the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"employee-service\"})}),\".\"]}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" com\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"codecrust\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"employee\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"models\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`EmployeeResponse\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" com\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"codecrust\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"employee\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"services\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`EmployeeService\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"bind\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"annotation\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`GetMapping\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"bind\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"annotation\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`PathVariable\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"bind\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"annotation\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`RestController\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@RestController\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"EmployeeController\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" service\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" EmployeeService\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@GetMapping\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token string\",children:'\"/employee/{employeeId}\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"fun\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"getEmployeeById\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@PathVariable\"}),\" employeeId\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" String\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" EmployeeResponse \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"return\"}),\" service\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"getEmployeeById\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),\"employeeId\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Afterwards, let's create a simple contract test called \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"EmployeeControllerContractTests\"})}),\" for the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"EmployeeController\"})}),\".\"]}),(0,n.jsx)(e.pre,{className:\"language-kotlin\",children:(0,n.jsxs)(e.code,{className:\"language-kotlin code-highlight\",children:[(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"hamcrest\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"CoreMatchers\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`containsString\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"junit\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"jupiter\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"api\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`Test\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"beans\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"factory\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"annotation\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`Autowired\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"boot\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"test\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"autoconfigure\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"servlet\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`AutoConfigureMockMvc\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"boot\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"test\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"context\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`SpringBootTest\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"cloud\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"contract\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"stubrunner\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"spring\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`AutoConfigureStubRunner\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"cloud\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"contract\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"stubrunner\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"spring\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`StubRunnerProperties\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"test\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"servlet\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`MockMvc\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"test\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"servlet\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"request\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"MockMvcRequestBuilders\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`get\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"test\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"servlet\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"result\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"MockMvcResultMatchers\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`content\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"test\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"servlet\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"result\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"MockMvcResultMatchers\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`status\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"import\"}),\" org\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"springframework\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"test\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"web\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"servlet\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"result\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"MockMvcResultHandlers\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`print\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@SpringBootTest\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@AutoConfigureMockMvc\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@AutoConfigureStubRunner\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" ids \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"[\"}),(0,n.jsx)(e.span,{className:\"token string\",children:'\"com.codecrust:department:+:stubs:8100\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"]\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\",\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" stubsMode \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" StubRunnerProperties\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),\"StubsMode\",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),`LOCAL\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),\" EmployeeControllerContractTests \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@Autowired\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"private\"}),\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"val\"}),\" mockMvc\",(0,n.jsx)(e.span,{className:\"token operator\",children:\":\"}),\" MockMvc\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"?\"}),\" \",(0,n.jsx)(e.span,{className:\"token operator\",children:\"=\"}),\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"null\"}),`\n`]}),(0,n.jsx)(e.span,{className:\"code-line\",children:`\n`}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@Test\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token annotation builtin\",children:\"@Throws\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),\"Exception\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"::\"}),(0,n.jsx)(e.span,{className:\"token keyword\",children:\"class\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"fun\"}),\" \",(0,n.jsx)(e.span,{className:\"token function\",children:\"shouldReturnDefaultMessage\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"{\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" mockMvc\",(0,n.jsx)(e.span,{className:\"token operator\",children:\"!!\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"perform\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token keyword\",children:\"get\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token string\",children:'\"/employee/employee-1\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"andDo\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"print\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"andExpect\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"status\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"isOk\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"andExpect\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"content\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\".\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"string\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token function\",children:\"containsString\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"(\"}),(0,n.jsx)(e.span,{className:\"token string\",children:'\"{\\\\\"id\\\\\":\\\\\"employee-id\\\\\",\\\\\"name\\\\\":\\\\\"John\\\\\",\\\\\"department\\\\\":\\\\\"Sales\\\\\"}\"'}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),(0,n.jsx)(e.span,{className:\"token punctuation\",children:\")\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[\" \",(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]}),(0,n.jsxs)(e.span,{className:\"code-line\",children:[(0,n.jsx)(e.span,{className:\"token punctuation\",children:\"}\"}),`\n`]})]})}),(0,n.jsxs)(e.p,{children:[\"Next, make an additional change by adding the following lines to the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"application.properties\"})}),\" file.\"]}),(0,n.jsx)(e.pre,{children:(0,n.jsxs)(e.code,{className:\"code-highlight\",children:[(0,n.jsx)(e.span,{className:\"code-line\",children:`server.port = 8081\n`}),(0,n.jsx)(e.span,{className:\"code-line\",children:`producer.port = 8080 # port at which department-service (producer) running on\n`})]})}),(0,n.jsx)(e.p,{children:\"That's it! We are now ready. If we run the tests, they will verify the finalized contract and report an error if it does not match.\"}),(0,n.jsxs)(e.h3,{id:\"failure-case\",children:[(0,n.jsx)(e.a,{href:\"#failure-case\",\"aria-hidden\":\"true\",tabIndex:\"-1\",children:(0,n.jsx)(e.span,{className:\"icon icon-link\"})}),\"Failure Case:\"]}),(0,n.jsxs)(e.p,{children:[\"Now, let's examine what happens if the contract is modified. To do that, navigate to the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"department-service\"})}),\" and remove the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"id\"})}),\" field from \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"DepartmentResponse\"})}),\", \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"DepartmentService\"})}),\", and \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"get_department_by_employee_id.groovy\"})}),\". Afterward, run the application. Next, attempt to run the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"EmployeeControllerContractTests\"})}),\" again. You will observe that the test fails because it expects the \",(0,n.jsx)(e.strong,{children:(0,n.jsx)(e.code,{children:\"id\"})}),\" field in the contract, which is now missing. This demonstrates how contract testing can identify inconsistencies and ensure compliance between the producer and consumer.\"]})]})}}var v=w;function b(a,s){throw new Error(\"Expected \"+(s?\"component\":\"object\")+\" `\"+a+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return I;})();\n;return Component;","toc":[{"value":"Contract Testing","url":"#contract-testing","depth":2},{"value":"Spring Cloud Contracts","url":"#spring-cloud-contracts","depth":2},{"value":"Implementation","url":"#implementation","depth":2},{"value":"Producer","url":"#producer","depth":2},{"value":"Department Service","url":"#department-service","depth":3},{"value":"Consumer","url":"#consumer","depth":2},{"value":"Employee Service","url":"#employee-service","depth":3},{"value":"Failure Case:","url":"#failure-case","depth":3}],"frontMatter":{"readingTime":{"text":"13 min read","minutes":12.245,"time":734700,"words":2449},"slug":"testing/spring-cloud-contracts","fileName":"testing/spring-cloud-contracts.mdx","title":"How to Test Your Microservices with Spring Cloud Contracts","heading":"How to Test Your Microservices with Spring Cloud Contracts","date":"2023-07-01T00:00:00.000Z","tags":["contract-testing"],"draft":false,"summary":"Explore the advantages of contract testing with Spring Boot Cloud Contract testing framework. Learn through practical examples in this blog on how and why to use Spring Cloud Contracts for effective contract testing.","authors":["usmanakhtar"],"repoName":"/tree/main/How%20to%20Test%20Your%20Microservices%20with%20Spring%20Cloud%20Contracts","newsletterActionText":"Boost your testing skills with the latest methods and tools, keeping your code robust and ready for success"}},"authorDetails":[{"readingTime":{"text":"2 min read","minutes":1.025,"time":61500,"words":205},"slug":"usmanakhtar","fileName":"usmanakhtar.md","name":"Usman Akhtar","avatar":"/static/images/usmanakhtar-avatar.png","occupation":"Software Engineer","email":"contact@usmanakhtar.dev","twitter":"https://twitter.com/usmakhtar","linkedin":"https://www.linkedin.com/in/usmakhtar","github":"https://github.com/usmanakhtar-dev","description":"Experienced software engineer with a passion for building elegant and efficient solutions to complex problems. Committed to continuously learning and adapting to new technologies and techniques.","date":null}],"prev":{"title":"Understand Type System in Programming Languages","heading":"Understand Type System in Programming Languages","//":null,"date":"2023-06-10T00:00:00.000Z","tags":["architecture"],"draft":false,"summary":"Understanding type systems in programming languages can help in choosing the best coding language for your next project. Explore different concepts in this blog, such as type change, type safety, type declaration, type strength, typeless languages and dynamic vs. static languages.","authors":["usmanakhtar"],"newsletterActionText":"Stay sharp with the latest in coding trends and frameworks to keep your skills up-to-date","slug":"architecture/type-systems"},"next":{"title":"Couchbase Database: Everything you need to know","heading":"Couchbase Database: Everything you need to know","//":null,"date":"2023-10-22T00:00:00.000Z","tags":["database"],"draft":false,"summary":"Discover how Couchbase stands out from other databases, understand what does Couchbase do, and learn about its advantages and drawbacks. Explore Couchbase data types, data modelling best practices, and how to create and retrieve data using indexes.","authors":["usmanakhtar"],"newsletterActionText":"Keep yourself in the know with the most recent articles on Couchbase and other databases","slug":"database/couchbase"}},"__N_SSG":true}