<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – Testing</title>
    <link>https://www.devkuma.com/en/tags/testing/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/testing/logo/180x180.jpg</url>
      <title>Testing</title>
      <link>https://www.devkuma.com/en/tags/testing/</link>
    </image>
    <description>Recent content in Testing on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/testing/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Test Overview</title>
      <link>https://www.devkuma.com/en/docs/testing/overview/</link>
      <pubDate>Thu, 15 Sep 2022 20:08:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/testing/overview/</guid>
      <description>
        
        
        &lt;h2 id=&#34;types-of-tests&#34;&gt;Types of Tests&lt;/h2&gt;
&lt;h3 id=&#34;unit-test&#34;&gt;Unit Test&lt;/h3&gt;
&lt;p&gt;A unit test is a program test performed at the class or function level. It mainly checks whether units behave as designed and whether their logical structure is appropriate.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Functional confirmation test
&lt;ul&gt;
&lt;li&gt;A test that checks whether a module behaves according to its design or specification.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Control flow test
&lt;ul&gt;
&lt;li&gt;A test that checks whether commands, branches, and similar elements work according to the program&amp;rsquo;s logical structure.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Data flow test
&lt;ul&gt;
&lt;li&gt;A test that checks whether data or variables are executed in the order of definition, use, and disposal.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;integration-testing&#34;&gt;Integration Testing&lt;/h3&gt;
&lt;p&gt;Integration testing combines and runs programs that have been verified by unit tests.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;State transition test
&lt;ul&gt;
&lt;li&gt;A test that checks behavior based on a state transition diagram.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;functional-testing&#34;&gt;Functional Testing&lt;/h3&gt;
&lt;p&gt;Functional testing tests integrated programs as a single feature.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Functional confirmation test&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;system-testing&#34;&gt;System Testing&lt;/h3&gt;
&lt;p&gt;System testing verifies whether a program made by combining individual programs or features behaves according to the specification.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Confirmation testing&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Regression testing
&lt;ul&gt;
&lt;li&gt;A test that checks whether changed parts work correctly after a program feature has been modified or changed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Degrade testing
&lt;ul&gt;
&lt;li&gt;A test that checks whether existing behavior continues to work after a program feature is added or changed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Evaluation testing&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Security Test
&lt;ul&gt;
&lt;li&gt;A test that checks whether the system can respond to malicious external attacks and whether vulnerabilities exist.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Usability Test
&lt;ul&gt;
&lt;li&gt;A test that checks whether the system is visually easy to read and easy for users to operate, learn, and understand.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Fault tolerance test
&lt;ul&gt;
&lt;li&gt;A test that checks whether specified functions are maintained when a failure occurs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Load testing&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Performance Test
&lt;ul&gt;
&lt;li&gt;A test that checks whether processing capacity satisfies the specification.&lt;/li&gt;
&lt;li&gt;A test that measures how much performance a system element shows under a specific condition.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Long-run test
&lt;ul&gt;
&lt;li&gt;A test that checks whether processing capacity or uptime remains healthy during long continuous operation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Load Test
&lt;ul&gt;
&lt;li&gt;A test that checks whether the system can keep operating even under extremely heavy load.&lt;/li&gt;
&lt;li&gt;A test that applies a specific load for a limited time and checks whether a web application has any problems.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Endurance Test
&lt;ul&gt;
&lt;li&gt;A test similar to a load test, performed by applying load over a long period. It is also called an aging test.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Stress Test
&lt;ul&gt;
&lt;li&gt;A test that gradually increases load to find the load threshold.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Peak Test
&lt;ul&gt;
&lt;li&gt;A test that applies an unsustainable load for a short moment and checks whether the web application keeps running, works correctly, and recovers.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;user-testing&#34;&gt;User Testing&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Acceptance testing
&lt;ul&gt;
&lt;li&gt;A test that checks whether the target system satisfies user requirements.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Operational testing
&lt;ul&gt;
&lt;li&gt;A test that checks whether the system works normally in the real operating environment.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Alpha testing
&lt;ul&gt;
&lt;li&gt;A test in which people other than developers operate the system and check for defects.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Beta testing
&lt;ul&gt;
&lt;li&gt;A test in which general users other than developers operate a product before development is complete or before release and check for defects.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;test-techniques&#34;&gt;Test Techniques&lt;/h2&gt;
&lt;h3 id=&#34;white-box-testing&#34;&gt;White-Box Testing&lt;/h3&gt;
&lt;p&gt;White-box testing means testing while understanding and consciously considering the contents of the system. It is mainly used in unit testing and is classified into the following tests.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Control flow test&lt;/li&gt;
&lt;li&gt;Data flow test&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When performing white-box testing, the logical structure, such as the processing flow and execution order, must be visualized. One way to do this is with a flowchart.&lt;/p&gt;
&lt;h4 id=&#34;test-coverage&#34;&gt;Test Coverage&lt;/h4&gt;
&lt;p&gt;Test coverage indicates how sufficient testing is when discussing tests for a system or software. In other words, it expresses as a ratio how much the executed tests cover the test target.&lt;/p&gt;
&lt;p&gt;Representative code coverage types are as follows.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Statement Coverage
&lt;ul&gt;
&lt;li&gt;This is also called line coverage. It is satisfied when each line of code is executed at least once.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Decision Coverage
&lt;ul&gt;
&lt;li&gt;This is also called branch coverage. It is satisfied when every conditional expression has both true and false outcomes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Condition Coverage
&lt;ul&gt;
&lt;li&gt;Here, conditions mean all conditional expressions. This checks whether each internal condition satisfies both true and false cases.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Other forms of code coverage also exist.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Condition/Decision Coverage&lt;/li&gt;
&lt;li&gt;Modified Condition/Decision Coverage&lt;/li&gt;
&lt;li&gt;Multiple Condition Coverage&lt;/li&gt;
&lt;li&gt;All Path Coverage&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;black-box-testing&#34;&gt;Black-Box Testing&lt;/h3&gt;
&lt;p&gt;Black-box testing is a method of inspecting behavior without knowing the internal structure or operating principles of the software.&lt;/p&gt;
&lt;p&gt;After unit testing with white-box testing is complete, testing proceeds without considering the internal structure of the system.&lt;br&gt;
It is mainly classified as functional testing and system testing.&lt;/p&gt;
&lt;p&gt;In black-box testing, tests are performed in the following order.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Define the purpose of the test.&lt;/li&gt;
&lt;li&gt;Identify the functions.&lt;/li&gt;
&lt;li&gt;Extract test viewpoints. For example, checking values submitted from a form.&lt;/li&gt;
&lt;li&gt;Assign the test viewpoints to functions.&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;Normal cases&lt;/li&gt;
&lt;li&gt;Abnormal cases&lt;/li&gt;
&lt;li&gt;Combined cases&lt;/li&gt;
&lt;li&gt;etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;Decide the test technique.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://velog.io/@lxxjn0/%EC%BD%94%EB%93%9C-%EB%B6%84%EC%84%9D-%EB%8F%84%EA%B5%AC-%EC%A0%81%EC%9A%A9%EA%B8%B0-1%ED%8E%B8-%EC%BD%94%EB%93%9C-%EC%BB%A4%EB%B2%84%EB%A6%AC%EC%A7%80Code-Coverage%EA%B0%80-%EB%AD%94%EA%B0%80%EC%9A%94&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Applying a Code Analysis Tool - Part 1, What Is Code Coverage?&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Testing</category>
      
    </item>
    
    <item>
      <title>Unit Testing</title>
      <link>https://www.devkuma.com/en/docs/testing/unit/</link>
      <pubDate>Thu, 15 Sep 2022 20:08:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/testing/unit/</guid>
      <description>
        
        
        &lt;h2 id=&#34;unit-testing&#34;&gt;Unit Testing&lt;/h2&gt;
&lt;p&gt;Write unit tests according to the basic guidelines below.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Test public methods.&lt;/li&gt;
&lt;li&gt;Mock dependency objects that affect test results.&lt;/li&gt;
&lt;li&gt;Avoid using disk-related dependencies where possible.&lt;/li&gt;
&lt;li&gt;Do not use network-related dependencies.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;unit-testing-frameworks-by-language&#34;&gt;Unit Testing Frameworks by Language&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Java: &lt;a href=&#34;https://www.devkuma.com/docs/junit/&#34;&gt;JUnit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Kotlin: &lt;a href=&#34;https://www.devkuma.com/docs/kotlin/mockk/&#34;&gt;MockK&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;personal-thoughts-on-test-code&#34;&gt;Personal Thoughts on Test Code&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;I think test code is a kind of insurance.
&lt;ul&gt;
&lt;li&gt;This means that when code changes and there is no test code, you become uncertain whether the code really works correctly. If tests exist, that anxiety disappears.&lt;/li&gt;
&lt;li&gt;Since people write code, everyone makes mistakes. When you write test code, you think through all possible cases and can prove behavior by running them.&lt;/li&gt;
&lt;li&gt;The system can operate without tests, but I think having them makes it more dependable.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;I think writing test code is proof that the logic works correctly.
&lt;ul&gt;
&lt;li&gt;It proves that the code is implemented to behave correctly.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test code can become a requirements specification.
&lt;ul&gt;
&lt;li&gt;It helps you understand under what requirements the source code behaves and how it works.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://howtodoinjava.com/best-practices/unit-testing-best-practices-junit-reference-guide/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;JUnit Best Practices Guide | HowToDoInJava&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Testing</category>
      
    </item>
    
    <item>
      <title>TDD(Test Driven Development)</title>
      <link>https://www.devkuma.com/en/docs/testing/tdd/</link>
      <pubDate>Thu, 30 Sep 2021 14:47:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/testing/tdd/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-tddtest-driven-development&#34;&gt;What Is TDD(Test Driven Development)?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Test-driven development.&lt;/li&gt;
&lt;li&gt;It is a development method in which you first write test code, run tests with it, and proceed while receiving feedback on whether the code works correctly.&lt;/li&gt;
&lt;li&gt;It is a development process that depends on repeating short development cycles. Developers first write test cases for the required feature, write code that satisfies them, pass the tests, and then refactor as appropriate.&lt;/li&gt;
&lt;li&gt;Because developers must clearly understand the requirements of a feature in order to write tests, TDD helps them focus on requirements before development. However, the entry barrier for testing and the increase in code that must be written are considered disadvantages.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;what-is-a-mock&#34;&gt;What Is a Mock?&lt;/h2&gt;
&lt;p&gt;A mock is a fake object created when using a real object is costly or when high dependency between objects makes implementation difficult.&lt;/p&gt;
&lt;h2 id=&#34;examples-of-mock-usage&#34;&gt;Examples of Mock Usage&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Building an environment for writing tests&lt;/li&gt;
&lt;li&gt;When a test depends on a specific case or moment&lt;/li&gt;
&lt;li&gt;When a test takes a long time&lt;/li&gt;
&lt;li&gt;When operation may take a long time because of performance limitations on a personal PC or server&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;what-is-mockito&#34;&gt;What Is Mockito?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Mockito is a Java mocking framework for unit testing.&lt;/li&gt;
&lt;li&gt;It is a test framework that supports mock objects in Java unit tests.&lt;/li&gt;
&lt;li&gt;In other words, it is a framework that creates mocks for unit testing.&lt;/li&gt;
&lt;li&gt;It can create mock objects, define mock object behavior, and verify whether the logic under test was performed correctly.&lt;/li&gt;
&lt;li&gt;In general, when developing a web application such as one based on Spring, dependencies exist between multiple objects. These dependencies make unit tests difficult to write, and Mockito can be used to inject fake objects to solve this problem.&lt;/li&gt;
&lt;li&gt;By using Mockito, you can stub the desired results on fake objects and perform unit testing.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;dependency-injection-for-mock-objects&#34;&gt;Dependency Injection for Mock Objects&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Mockito mainly uses three annotations for dependency injection of mock objects.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;@Mock&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;An annotation that creates and returns a mock object.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;@Spy&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;An annotation that uses the original methods as-is for methods that have not been stubbed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;@InjectMocks&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;An annotation that automatically injects fake objects created with &lt;code&gt;@Mock&lt;/code&gt; or &lt;code&gt;@Spy&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For example, when writing a unit test for &lt;code&gt;UserController&lt;/code&gt;, if it uses &lt;code&gt;UserService&lt;/code&gt;, you can create a fake &lt;code&gt;UserService&lt;/code&gt; with the &lt;code&gt;@Mock&lt;/code&gt; annotation and inject it into &lt;code&gt;UserController&lt;/code&gt; with &lt;code&gt;@InjectMocks&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>TDD</category>
      
      <category>Testing</category>
      
    </item>
    
    <item>
      <title>BDD(Behavior Driven Development)</title>
      <link>https://www.devkuma.com/en/docs/testing/bdd/</link>
      <pubDate>Wed, 29 Sep 2021 14:51:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/testing/bdd/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-bdd&#34;&gt;What Is BDD?&lt;/h2&gt;
&lt;p&gt;BDD(Behavior Driven Development) is behavior-driven development.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;BDD is a development method derived from TDD.&lt;/li&gt;
&lt;li&gt;It goes one step further than TDD(Test Driven Development) and makes the test cases themselves serve as requirements.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;basic-bdd-pattern&#34;&gt;Basic BDD Pattern&lt;/h2&gt;
&lt;p&gt;BDD writes test cases based on scenarios and does not recommend function-level unit tests. Scenarios should be written at a level that even non-developers can understand.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Feature: Specifies the function or responsibility of the test target.&lt;/li&gt;
&lt;li&gt;Scenario: Describes the situation for the test objective.&lt;/li&gt;
&lt;li&gt;Given: Sets the values needed to proceed with the scenario.&lt;/li&gt;
&lt;li&gt;When: Specifies the conditions needed to proceed with the scenario.&lt;/li&gt;
&lt;li&gt;Then: Specifies the result that must be guaranteed when the scenario is complete.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-Kotlin&#34; data-lang=&#34;Kotlin&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@Test&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;fun&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;`aliases for behavior driven development`&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;// given
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;given&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;calculatorService&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;add&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;20.0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;10.0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)).&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;willReturn&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;30.0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;// when
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;val&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;result&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;calculatorService&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;add&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;20.0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;10.0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;// then
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;Assert&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;assertThat&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;30.0&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;CoreMatchers&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;`is`&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;result&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;related-video&#34;&gt;Related Video&lt;/h2&gt;
&lt;iframe width=&#34;600&#34; height=&#34;350&#34; src=&#34;https://tv.kakao.com/embed/player/cliplink/414004682?service=kakao_tv&amp;section=channel&amp;profile=HIGH&amp;wmode=transparent&amp;popup=1&amp;autoplay=1&#34; title=&#34;Why TiDB?&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&#34; allowfullscreen&gt;&lt;/iframe&gt;
&lt;p&gt;&lt;em&gt;Kakao if - &amp;ldquo;If You Have Kotest, Ask About TDD and Go with BDD!&amp;rdquo;&lt;/em&gt;&lt;/p&gt;

      </description>
      
      <category>BDD</category>
      
      <category>Testing</category>
      
    </item>
    
    <item>
      <title>F.I.R.S.T Principles</title>
      <link>https://www.devkuma.com/en/docs/testing/first/</link>
      <pubDate>Thu, 30 Sep 2021 14:47:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/testing/first/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-are-the-first-principles&#34;&gt;What Are the F.I.R.S.T Principles?&lt;/h2&gt;
&lt;p&gt;The FIRST principles were first proposed by Bob Martin, the author of the well-known book &amp;ldquo;Clean Code&amp;rdquo;.
Unit tests are organized according to the F.I.R.S.T principles.&lt;/p&gt;
&lt;h3 id=&#34;fast&#34;&gt;&lt;strong&gt;F&lt;/strong&gt;ast&lt;/h3&gt;
&lt;p&gt;Unit tests should run quickly and produce results quickly.&lt;br&gt;
Therefore, the unit of work should be as small as possible. To make tests fast, they should not use real servers or databases; instead, they should use fake data, or mock data.&lt;/p&gt;
&lt;h3 id=&#34;isolated--independent&#34;&gt;&lt;strong&gt;I&lt;/strong&gt;solated / Independent&lt;/h3&gt;
&lt;p&gt;Unit tests should be executable on their own.&lt;br&gt;
In other words, they must be independent and must not depend on or affect other tests.&lt;/p&gt;
&lt;h3 id=&#34;repeatable&#34;&gt;&lt;strong&gt;R&lt;/strong&gt;epeatable&lt;/h3&gt;
&lt;p&gt;Unit tests must be repeatable.&lt;br&gt;
No matter where, how, or how many times a test is run, it should produce the same result.&lt;/p&gt;
&lt;h3 id=&#34;self-validating&#34;&gt;&lt;strong&gt;S&lt;/strong&gt;elf-validating&lt;/h3&gt;
&lt;p&gt;Unit tests must be self-validating.&lt;br&gt;
The test itself should produce a pass or fail result, and this should happen automatically.&lt;/p&gt;
&lt;h3 id=&#34;thorough--timely&#34;&gt;&lt;strong&gt;T&lt;/strong&gt;horough / Timely&lt;/h3&gt;
&lt;p&gt;Unit tests must be thorough and written at the right time.&lt;br&gt;
Being thorough means testing all data. Tests should include the range from minimum to maximum, cover data that changes by role, such as user and administrator cases, and also test which cases fail through exceptions or errors.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://howtodoinjava.com/best-practices/first-principles-for-good-tests/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;FIRST Principles for Writing Good Unit Tests | HowToDoInJava&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Testing</category>
      
    </item>
    
    <item>
      <title>WebClient Testing - Testing External API Calls with MockWebServer</title>
      <link>https://www.devkuma.com/en/docs/mock-web-server/</link>
      <pubDate>Sat, 17 Dec 2022 16:31:28 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/mock-web-server/</guid>
      <description>
        
        
        &lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;Most modern services are expected to call REST APIs. Spring provides several options for building REST clients and recommends WebClient.&lt;/p&gt;
&lt;p&gt;This page explains how to unit test a service that calls an API by using WebClient.&lt;/p&gt;
&lt;h2 id=&#34;what-is-mockwebserver&#34;&gt;What Is MockWebServer?&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/square/okhttp/tree/master/mockwebserver&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;MockWebServer from Square&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; is a small, simple web server that receives HTTP requests and returns responses.&lt;/p&gt;
&lt;p&gt;When testing methods that call HTTP through clients such as WebClient or RestTemplate, you can point the client to MockWebServer and write tests more easily. The Spring team also recommends using MockWebServer for this kind of test.&lt;/p&gt;
&lt;h2 id=&#34;creating-a-simple-webclient-project&#34;&gt;Creating a Simple WebClient Project&lt;/h2&gt;
&lt;p&gt;Before using MockWebServer, create a simple project that uses &lt;code&gt;WebClient&lt;/code&gt; as the test target. The sample project can be generated from Spring Initializr with Java 11, Gradle, Spring Boot 2.7.6, and the &lt;code&gt;webflux&lt;/code&gt; dependency.&lt;/p&gt;
&lt;p&gt;Create a DTO object to receive data, then create service code that uses &lt;code&gt;WebClient&lt;/code&gt; to call &lt;code&gt;/users/{id}&lt;/code&gt; and returns &lt;code&gt;Mono&amp;lt;User&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;applying-mockwebserver&#34;&gt;Applying MockWebServer&lt;/h2&gt;
&lt;h3 id=&#34;adding-the-dependency&#34;&gt;Adding the Dependency&lt;/h3&gt;
&lt;p&gt;Add the MockWebServer test dependency.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-groovy&#34; data-lang=&#34;groovy&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;dependencies&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#000&#34;&gt;testImplementation&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;com.squareup.okhttp3:mockwebserver&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;adding-mockwebserver-to-test-code&#34;&gt;Adding MockWebServer to Test Code&lt;/h3&gt;
&lt;p&gt;In test code, create a &lt;code&gt;MockWebServer&lt;/code&gt; object in &lt;code&gt;@BeforeAll&lt;/code&gt;, start it, and shut it down in &lt;code&gt;@AfterAll&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;passing-webclient-to-the-service&#34;&gt;Passing WebClient to the Service&lt;/h3&gt;
&lt;p&gt;Create a &lt;code&gt;WebClient&lt;/code&gt; with a base URL that uses the MockWebServer port and pass it to the service.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#5c35cc;font-weight:bold&#34;&gt;@BeforeEach&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;void&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;initialize&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;final&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;String&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;baseUrl&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;String&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#c4a000&#34;&gt;format&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;http://localhost:%s&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;mockWebServer&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#c4a000&#34;&gt;getPort&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;());&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;final&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;WebClient&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;webClient&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;WebClient&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#c4a000&#34;&gt;create&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;baseUrl&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;    &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;userService&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;new&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;UserService&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;webClient&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With this setup, the test calls MockWebServer instead of a real external URL.&lt;/p&gt;
&lt;h3 id=&#34;creating-an-arbitrary-response&#34;&gt;Creating an Arbitrary Response&lt;/h3&gt;
&lt;p&gt;Create a &lt;code&gt;MockResponse&lt;/code&gt;, set the body and headers, and put it into &lt;code&gt;enqueue&lt;/code&gt;. MockWebServer returns responses in the order they were enqueued.&lt;/p&gt;
&lt;h3 id=&#34;checking-the-request&#34;&gt;Checking the Request&lt;/h3&gt;
&lt;p&gt;Besides checking the response value, you can also inspect the request with &lt;code&gt;takeRequest()&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;final&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;RecordedRequest&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;recordedRequest&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;mockWebServer&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#c4a000&#34;&gt;takeRequest&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;();&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;assertAll&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;assertEquals&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;GET&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;recordedRequest&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#c4a000&#34;&gt;getMethod&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()),&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;        &lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;()&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;assertEquals&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;/users/3&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt; &lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;recordedRequest&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#c4a000&#34;&gt;getPath&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;())&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;&lt;span style=&#34;color:#f8f8f8&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/square/okhttp/blob/master/mockwebserver/README.md&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;square/okhttp | GitHub&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.baeldung.com/spring-mocking-webclient&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Mocking a WebClient in Spring | Baeldung&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;The example code above is available on &lt;a href=&#34;https://github.com/devkuma/spring-tutorial/tree/main/spring-mockwebserver&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;

      </description>
      
      <category>Testing</category>
      
      <category>Java</category>
      
    </item>
    
  </channel>
</rss>
