{"id":581,"date":"2025-03-24T08:53:15","date_gmt":"2025-03-23T23:53:15","guid":{"rendered":"https:\/\/dexall.co.jp\/articles\/?p=581"},"modified":"2025-03-24T08:53:15","modified_gmt":"2025-03-23T23:53:15","slug":"%e3%80%90%e5%ae%9f%e8%b7%b5%e3%82%ac%e3%82%a4%e3%83%89%e3%80%91junit%e3%81%a8mockito%e3%81%a7%e5%ad%a6%e3%81%b69%e3%81%a4%e3%81%ae%e3%83%a2%e3%83%83%e3%82%af%e3%83%91%e3%82%bf%e3%83%bc%e3%83%b3","status":"publish","type":"post","link":"https:\/\/dexall.co.jp\/articles\/?p=581","title":{"rendered":"\u3010\u5b9f\u8df5\u30ac\u30a4\u30c9\u3011JUnit\u3068Mockito\u3067\u5b66\u30769\u3064\u306e\u30e2\u30c3\u30af\u30d1\u30bf\u30fc\u30f3 &#8211; \u73fe\u5834\u3067\u4f7f\u3048\u308b\u5177\u4f53\u4f8b\u4ed8\u304d"},"content":{"rendered":"\n<div class=\"toc\"><br \/>\n<b>Warning<\/b>:  Undefined array key \"is_admin\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>116<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_category_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>121<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_top\" in <b>\/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>128<\/b><br \/>\n    <div id=\"toc_container\" class=\"sgb-toc--bullets js-smooth-scroll\" data-dialog-title=\"\u76ee\u6b21\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">\u30e2\u30c3\u30af\u3068\u306f\uff1fJUnit\u30c6\u30b9\u30c8\u306b\u304a\u3051\u308b\u91cd\u8981\u6027<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">\u30e2\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u76ee\u7684\u3068\u52b9\u679c<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-2\">JUnit\u30c6\u30b9\u30c8\u3067\u30e2\u30c3\u30af\u304c\u5fc5\u8981\u306a\u30b1\u30fc\u30b93\u9078<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-6\">JUnit\u3067\u30e2\u30c3\u30af\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306e\u6e96\u5099<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-7\">Mockito\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u65b9\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-10\">\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u306e\u57fa\u672c\u69cb\u6210<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-11\">\u5b9f\u8df5\uff019\u3064\u306e\u57fa\u672c\u7684\u306a\u30e2\u30c3\u30af\u30d1\u30bf\u30fc\u30f3<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-12\">1. \u623b\u308a\u5024\u306e\u56fa\u5b9a\uff08when-thenReturn\uff09<\/a>      <\/li>      <li>        <a href=\"#i-13\">2. \u4f8b\u5916\u306e\u30b9\u30ed\u30fc\uff08when-thenThrow\uff09<\/a>      <\/li>      <li>        <a href=\"#i-14\">3. void \u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\uff08doNothing-when\uff09<\/a>      <\/li>      <li>        <a href=\"#i-15\">4. \u5f15\u6570\u306e\u30de\u30c3\u30c1\u30f3\u30b0\uff08ArgumentMatchers\uff09<\/a>      <\/li>      <li>        <a href=\"#i-16\">5. \u30e1\u30bd\u30c3\u30c9\u547c\u3073\u51fa\u3057\u56de\u6570\u306e\u691c\u8a3c\uff08verify\uff09<\/a>      <\/li>      <li>        <a href=\"#i-17\">6. \u30b9\u30d1\u30a4\u3092\u4f7f\u7528\u3057\u305f\u30d1\u30fc\u30b7\u30e3\u30eb\u30e2\u30c3\u30af<\/a>      <\/li>      <li>        <a href=\"#i-18\">7. static \u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316<\/a>      <\/li>      <li>        <a href=\"#i-19\">8. \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u30e2\u30c3\u30af\u5316<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-20\">9. \u8907\u6570\u306e\u623b\u308a\u5024\u3092\u9806\u756a\u306b\u8fd4\u3059\uff08thenReturn chain\uff09<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-21\">\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3088\u304f\u3042\u308b\u30e2\u30c3\u30af\u306e\u4f7f\u7528\u4f8b<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-22\">\u5916\u90e8API\u3068\u306e\u901a\u4fe1\u51e6\u7406\u306e\u30e2\u30c3\u30af\u5316<\/a>      <\/li>      <li>        <a href=\"#i-23\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u306e\u30e2\u30c3\u30af\u5316<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-24\">\u6642\u9593\u306b\u4f9d\u5b58\u3059\u308b\u51e6\u7406\u306e\u30e2\u30c3\u30af\u5316<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-25\">\u30e2\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u6ce8\u610f\u70b9\u3068\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-26\">\u904e\u5ea6\u306a\u30e2\u30c3\u30af\u5316\u3092\u907f\u3051\u308b\u65b9\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-28\">\u30c6\u30b9\u30c8\u306e\u53ef\u8aad\u6027\u3092\u9ad8\u3081\u308bTips<\/a>      <\/li>      <li>        <a href=\"#i-31\">\u30e2\u30c3\u30af\u306e\u4ee3\u308f\u308a\u306b\u30b9\u30bf\u30d6\u3092\u4f7f\u3046\u3079\u304d\u30b1\u30fc\u30b9<\/a>      <\/li>      <li>        <a href=\"#i-32\">NullPointerException\u304c\u767a\u751f\u3059\u308b\u5834\u5408\u306e\u5bfe\u51e6\u6cd5<\/a>      <\/li>      <li>        <a href=\"#i-35\">\u30e2\u30c3\u30af\u306e\u623b\u308a\u5024\u304c\u671f\u5f85\u901a\u308a\u3067\u306a\u3044\u5834\u5408\u306e\u78ba\u8a8d\u30dd\u30a4\u30f3\u30c8<\/a>      <\/li>      <li>        <a href=\"#i-37\">verify()\u304c\u5931\u6557\u3059\u308b\u969b\u306e\u30c7\u30d0\u30c3\u30b0\u65b9\u6cd5<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-40\">\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u305f\u3081\u306eTips<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-41\">\u307e\u3068\u3081<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-42\">\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8\u6574\u7406<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-43\">\u6b21\u306e\u30b9\u30c6\u30c3\u30d7<\/a>      <\/li>    <\/ul>  <\/li><\/ul>\n      <a href=\"#\" class=\"sgb-toc-button js-toc-button\" rel=\"nofollow\" data-open-dialog=\"true\"><i class=\"fa fa-list\"><\/i><span class=\"sgb-toc-button__text\">\u76ee\u6b21\u3078<\/span><\/a>\n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">\u30e2\u30c3\u30af\u3068\u306f\uff1fJUnit\u30c6\u30b9\u30c8\u306b\u304a\u3051\u308b\u91cd\u8981\u6027<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-1\">\u30e2\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u76ee\u7684\u3068\u52b9\u679c<\/h3>\n\n\n\n<p>\u30e2\u30c3\u30af\u3068\u306f\u3001\u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30af\u30e9\u30b9\u304c\u4f9d\u5b58\u3057\u3066\u3044\u308b\u5916\u90e8\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6a21\u5023\u3059\u308b\u4ee3\u7528\u54c1\u3067\u3059\u3002\u5b9f\u969b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4ee3\u308f\u308a\u306b\u30e2\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u52b9\u679c\u304c\u5f97\u3089\u308c\u307e\u3059\uff1a<\/p>\n\n\n\n<div class=\"wp-block-sgb-block-simple sgb-box-simple sgb-box-simple--title-normal sgb-box-simple--with-border\"><div style=\"background-color:var(--wp--preset--color--sango-main);color:#FFF\" class=\"sgb-box-simple__title\">\u30e2\u30c3\u30af\u4f7f\u7528\u306b\u4f34\u3046\u671f\u5f85\u3055\u308c\u308b\u52b9\u679c<\/div><div class=\"sgb-box-simple__body\" style=\"border-color:var(--wp--preset--color--sango-main);background-color:#FFF\">\n<ol class=\"wp-block-list\">\n<li><strong>\u30c6\u30b9\u30c8\u306e\u5206\u96e2\u3068\u72ec\u7acb\u6027\u306e\u78ba\u4fdd<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u5916\u90e8\u4f9d\u5b58\u3092\u6301\u3064\u30b3\u30fc\u30c9\u3092\u5358\u4f53\u3067\u30c6\u30b9\u30c8\u53ef\u80fd<\/li>\n\n\n\n<li>\u30c6\u30b9\u30c8\u7d50\u679c\u304c\u5916\u90e8\u8981\u56e0\u306b\u5f71\u97ff\u3055\u308c\u306a\u3044<\/li>\n\n\n\n<li>\u3088\u308a\u5b89\u5b9a\u3057\u305f\u30c6\u30b9\u30c8\u306e\u5b9f\u73fe<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30c6\u30b9\u30c8\u5b9f\u884c\u306e\u9ad8\u901f\u5316<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30a2\u30af\u30bb\u30b9\u306a\u3069\u306e\u91cd\u3044\u51e6\u7406\u3092\u30b9\u30ad\u30c3\u30d7<\/li>\n\n\n\n<li>\u30c6\u30b9\u30c8\u306e\u5b9f\u884c\u6642\u9593\u3092\u5927\u5e45\u306b\u77ed\u7e2e<\/li>\n\n\n\n<li>CI\/CD\u30d1\u30a4\u30d7\u30e9\u30a4\u30f3\u306e\u52b9\u7387\u5316<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u30a8\u30c3\u30b8\u30b1\u30fc\u30b9\u306e\u30c6\u30b9\u30c8\u304c\u5bb9\u6613<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u4f8b\u5916\u767a\u751f\u306a\u3069\u306e\u7279\u6b8a\u306a\u30b1\u30fc\u30b9\u3092\u7c21\u5358\u306b\u518d\u73fe<\/li>\n\n\n\n<li>\u901a\u5e38\u3067\u306f\u767a\u751f\u3055\u305b\u306b\u304f\u3044\u72b6\u6cc1\u306e\u30c6\u30b9\u30c8\u304c\u53ef\u80fd<\/li>\n\n\n\n<li>\u3088\u308a\u5e83\u7bc4\u306a\u30c6\u30b9\u30c8\u30ab\u30d0\u30ec\u30c3\u30b8\u306e\u9054\u6210<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">JUnit\u30c6\u30b9\u30c8\u3067\u30e2\u30c3\u30af\u304c\u5fc5\u8981\u306a\u30b1\u30fc\u30b93\u9078<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-3\">1. \u5916\u90e8\u30b5\u30fc\u30d3\u30b9\u3068\u306e\u901a\u4fe1\u304c\u5fc5\u8981\u306a\u5834\u5408<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u5b9f\u969b\u306eAPI\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\npublic class WeatherApiClient {\n    public WeatherInfo getWeather(String city) {\n        \/\/ \u5b9f\u969b\u306eAPI\u547c\u3073\u51fa\u3057\uff08\u30c6\u30b9\u30c8\u6642\u306b\u547c\u3073\u305f\u304f\u306a\u3044\uff09\n        return callExternalApi(city);\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30af\u30e9\u30b9\npublic class WeatherService {\n    private WeatherApiClient client;\n\n    public boolean isSunnyDay(String city) {\n        WeatherInfo info = client.getWeather(city);  \/\/ \u3053\u3053\u3092\u30e2\u30c3\u30af\u5316\n        return \"SUNNY\".equals(info.getCondition());\n    }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-4\">2. \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u3092\u542b\u3080\u51e6\u7406<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30a2\u30af\u30bb\u30b9\u3092\u884c\u3046\u30ea\u30dd\u30b8\u30c8\u30ea\npublic class UserRepository {\n    public User findById(Long id) {\n        \/\/ \u5b9f\u969b\u306eDB\u63a5\u7d9a\uff08\u30c6\u30b9\u30c8\u6642\u306b\u907f\u3051\u305f\u3044\uff09\n        return executeQuery(\"SELECT * FROM users WHERE id = ?\", id);\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30b5\u30fc\u30d3\u30b9\npublic class UserService {\n    private UserRepository repository;\n\n    public String getUserName(Long id) {\n        User user = repository.findById(id);  \/\/ \u3053\u3053\u3092\u30e2\u30c3\u30af\u5316\n        return user.getName();\n    }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-5\">3. \u6642\u9593\u306b\u4f9d\u5b58\u3059\u308b\u51e6\u7406<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u73fe\u5728\u6642\u523b\u306b\u4f9d\u5b58\u3059\u308b\u51e6\u7406\npublic class ExpirationChecker {\n    public boolean isExpired(LocalDateTime expirationDate) {\n        LocalDateTime now = LocalDateTime.now();  \/\/ \u3053\u3053\u3092\u30e2\u30c3\u30af\u5316\n        return now.isAfter(expirationDate);\n    }\n}<\/pre>\n\n\n\n<p class=\"is-style-sango-paragraph-idea-alt\"><strong><span class=\"big\">\u30b1\u30fc\u30b9\u3054\u3068\u306e\u30e1\u30ea\u30c3\u30c8<\/span><\/strong><\/p>\n\n\n<div id=\"id-f5477cc7-02eb-4dd6-a5c2-4920faf457e9\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30e1\u30ea\u30c3\u30c8<\/th><th>\u8aac\u660e<\/th><\/tr><\/thead><tbody><tr><td>\u30c6\u30b9\u30c8\u306e\u4fe1\u983c\u6027\u5411\u4e0a<\/td><td>\u5916\u90e8\u8981\u56e0\u306b\u5de6\u53f3\u3055\u308c\u306a\u3044\u5b89\u5b9a\u3057\u305f\u30c6\u30b9\u30c8\u7d50\u679c\u304c\u5f97\u3089\u308c\u308b<\/td><\/tr><tr><td>\u958b\u767a\u52b9\u7387\u306e\u5411\u4e0a<\/td><td>\u30c6\u30b9\u30c8\u306e\u5b9f\u884c\u304c\u9ad8\u901f\u3067\u3001\u958b\u767a\u30b5\u30a4\u30af\u30eb\u304c\u77ed\u7e2e\u3055\u308c\u308b<\/td><\/tr><tr><td>\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u6027\u306e\u5411\u4e0a<\/td><td>\u30c6\u30b9\u30c8\u304c\u5206\u96e2\u3055\u308c\u3066\u304a\u308a\u3001\u5909\u66f4\u306e\u5f71\u97ff\u7bc4\u56f2\u304c\u9650\u5b9a\u3055\u308c\u308b<\/td><\/tr><tr><td>\u30c7\u30d0\u30c3\u30b0\u306e\u5bb9\u6613\u3055<\/td><td>\u30c6\u30b9\u30c8\u5931\u6557\u6642\u306e\u539f\u56e0\u7279\u5b9a\u304c\u5bb9\u6613\u306b\u306a\u308b<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u30e2\u30c3\u30af\u306e\u4f7f\u7528\u306f\u3001\u7279\u306b\u5927\u898f\u6a21\u306a\u30a8\u30f3\u30bf\u30fc\u30d7\u30e9\u30a4\u30ba\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u30c6\u30b9\u30c8\u306e\u54c1\u8cea\u3068\u958b\u767a\u52b9\u7387\u3092\u4e21\u7acb\u3055\u305b\u308b\u305f\u3081\u306e\u91cd\u8981\u306a\u6280\u8853\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u5b9f\u969b\u306bJUnit\u3067\u30e2\u30c3\u30af\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306e\u6e96\u5099\u624b\u9806\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-6\">JUnit\u3067\u30e2\u30c3\u30af\u3092\u5b9f\u88c5\u3059\u308b\u305f\u3081\u306e\u6e96\u5099<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-7\">Mockito\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u65b9\u6cd5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-8\">Maven \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u5834\u5408<\/h4>\n\n\n\n<p><code>pom.xml<\/code>\u306b\u4ee5\u4e0b\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u8ffd\u52a0\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;dependencies&gt;\n    &lt;!-- JUnit 5 --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.junit.jupiter&lt;\/groupId&gt;\n        &lt;artifactId&gt;junit-jupiter&lt;\/artifactId&gt;\n        &lt;version&gt;5.9.2&lt;\/version&gt;\n        &lt;scope&gt;test&lt;\/scope&gt;\n    &lt;\/dependency&gt;\n\n    &lt;!-- Mockito Core --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.mockito&lt;\/groupId&gt;\n        &lt;artifactId&gt;mockito-core&lt;\/artifactId&gt;\n        &lt;version&gt;5.3.1&lt;\/version&gt;\n        &lt;scope&gt;test&lt;\/scope&gt;\n    &lt;\/dependency&gt;\n\n    &lt;!-- Mockito JUnit Jupiter --&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;org.mockito&lt;\/groupId&gt;\n        &lt;artifactId&gt;mockito-junit-jupiter&lt;\/artifactId&gt;\n        &lt;version&gt;5.3.1&lt;\/version&gt;\n        &lt;scope&gt;test&lt;\/scope&gt;\n    &lt;\/dependency&gt;\n&lt;\/dependencies&gt;<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-9\">Gradle \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u5834\u5408<\/h4>\n\n\n\n<p><code>build.gradle<\/code>\u306b\u4ee5\u4e0b\u3092\u8ffd\u52a0\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dependencies {\n    testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'\n    testImplementation 'org.mockito:mockito-core:5.3.1'\n    testImplementation 'org.mockito:mockito-junit-jupiter:5.3.1'\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-10\">\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u306e\u57fa\u672c\u69cb\u6210<\/h3>\n\n\n\n<p>\u57fa\u672c\u7684\u306a\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u306e\u69cb\u9020\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import org.junit.jupiter.api.BeforeEach;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\nimport org.mockito.Mock;\nimport org.mockito.InjectMocks;\nimport org.mockito.junit.jupiter.MockitoExtension;\nimport static org.mockito.Mockito.*;\nimport static org.junit.jupiter.api.Assertions.*;\n\n@ExtendWith(MockitoExtension.class)  \/\/ Mockito\u306e\u6a5f\u80fd\u3092\u6709\u52b9\u5316\npublic class UserServiceTest {\n\n    @Mock  \/\/ \u30e2\u30c3\u30af\u5316\u3059\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\n    private UserRepository userRepository;\n\n    @InjectMocks  \/\/ \u30e2\u30c3\u30af\u3092\u6ce8\u5165\u3055\u308c\u308b\u5074\u306e\u30af\u30e9\u30b9\n    private UserService userService;\n\n    @BeforeEach\n    void setUp() {\n        \/\/ \u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u5b9f\u884c\u524d\u306e\u5171\u901a\u8a2d\u5b9a\n    }\n\n    @Test\n    void testGetUserName() {\n        \/\/ \u30e2\u30c3\u30af\u306e\u632f\u308b\u821e\u3044\u3092\u5b9a\u7fa9\n        when(userRepository.findById(1L))\n            .thenReturn(new User(1L, \"\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\"));\n\n        \/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u30e1\u30bd\u30c3\u30c9\u306e\u5b9f\u884c\n        String userName = userService.getUserName(1L);\n\n        \/\/ \u691c\u8a3c\n        assertEquals(\"\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\", userName);\n        verify(userRepository).findById(1L);\n    }\n}<\/pre>\n\n\n\n<p class=\"is-style-sango-paragraph-idea-alt\"><strong>\u4e3b\u8981\u306a\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3068\u5f79\u5272\uff1a<\/strong><\/p>\n\n\n<div id=\"id-55a3fa42-e715-4e13-9660-9eb599b5aeae\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3<\/th><th>\u7528\u9014<\/th><\/tr><\/thead><tbody><tr><td>@ExtendWith<\/td><td>Mockito\u306e\u6a5f\u80fd\u3092JUnit 5\u3067\u4f7f\u7528\u53ef\u80fd\u306b\u3059\u308b<\/td><\/tr><tr><td>@Mock<\/td><td>\u6307\u5b9a\u3057\u305f\u30af\u30e9\u30b9\u306e\u30e2\u30c3\u30af\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210<\/td><\/tr><tr><td>@InjectMocks<\/td><td>\u30e2\u30c3\u30af\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6ce8\u5165\u3059\u308b\u5bfe\u8c61\u3092\u6307\u5b9a<\/td><\/tr><tr><td>@BeforeEach<\/td><td>\u5404\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u5b9f\u884c\u524d\u306e\u5171\u901a\u51e6\u7406\u3092\u5b9a\u7fa9<\/td><\/tr><tr><td>@Test<\/td><td>\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3067\u3042\u308b\u3053\u3068\u3092\u793a\u3059<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<p>\u3053\u308c\u3067Mockito\u3092\u4f7f\u7528\u3057\u305f\u30c6\u30b9\u30c8\u306e\u5b9f\u88c5\u6e96\u5099\u304c\u6574\u3044\u307e\u3057\u305f\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u3053\u306e\u57fa\u672c\u69cb\u6210\u3092\u4f7f\u3063\u3066\u5177\u4f53\u7684\u306a\u30e2\u30c3\u30af\u30d1\u30bf\u30fc\u30f3\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-11\">\u5b9f\u8df5\uff019\u3064\u306e\u57fa\u672c\u7684\u306a\u30e2\u30c3\u30af\u30d1\u30bf\u30fc\u30f3<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-12\">1. \u623b\u308a\u5024\u306e\u56fa\u5b9a\uff08when-thenReturn\uff09<\/h3>\n\n\n\n<p>\u6700\u3082\u57fa\u672c\u7684\u306a\u30e2\u30c3\u30af\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002\u30e1\u30bd\u30c3\u30c9\u306e\u623b\u308a\u5024\u3092\u6307\u5b9a\u3057\u305f\u5024\u306b\u56fa\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30b5\u30fc\u30d3\u30b9\npublic class UserService {\n    private UserRepository userRepository;\n\n    public User findActiveUser(Long id) {\n        User user = userRepository.findById(id);\n        if (user != null &amp;&amp; user.isActive()) {\n            return user;\n        }\n        return null;\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\n@Test\nvoid testFindActiveUser() {\n    \/\/ \u30e2\u30c3\u30af\u306e\u623b\u308a\u5024\u3092\u8a2d\u5b9a\n    when(userRepository.findById(1L))\n        .thenReturn(new User(1L, \"\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\", true));\n\n    \/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n    User result = userService.findActiveUser(1L);\n\n    \/\/ \u691c\u8a3c\n    assertNotNull(result);\n    assertEquals(\"\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\", result.getName());\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-13\">2. \u4f8b\u5916\u306e\u30b9\u30ed\u30fc\uff08when-thenThrow\uff09<\/h3>\n\n\n\n<p>\u7570\u5e38\u7cfb\u306e\u30c6\u30b9\u30c8\u3092\u884c\u3046\u969b\u306b\u3001\u610f\u56f3\u7684\u306b\u4f8b\u5916\u3092\u30b9\u30ed\u30fc\u3055\u305b\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30b5\u30fc\u30d3\u30b9\npublic class PaymentService {\n    private PaymentGateway gateway;\n\n    public void processPayment(Payment payment) throws PaymentException {\n        try {\n            gateway.execute(payment);\n        } catch (GatewayException e) {\n            throw new PaymentException(\"\u6c7a\u6e08\u51e6\u7406\u306b\u5931\u6557\u3057\u307e\u3057\u305f\", e);\n        }\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\n@Test\nvoid testProcessPaymentFailure() {\n    Payment payment = new Payment(1000, \"JPY\");\n\n    \/\/ \u4f8b\u5916\u3092\u30b9\u30ed\u30fc\u3059\u308b\u3088\u3046\u306b\u8a2d\u5b9a\n    when(gateway.execute(payment))\n        .thenThrow(new GatewayException(\"\u63a5\u7d9a\u30a8\u30e9\u30fc\"));\n\n    \/\/ \u4f8b\u5916\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u3092\u691c\u8a3c\n    assertThrows(PaymentException.class, () -&gt; {\n        paymentService.processPayment(payment);\n    });\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-14\">3. void \u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\uff08doNothing-when\uff09<\/h3>\n\n\n\n<p>\u623b\u308a\u5024\u306e\u306a\u3044\u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30b5\u30fc\u30d3\u30b9\npublic class NotificationService {\n    private EmailSender emailSender;\n\n    public void notifyUser(String email, String message) {\n        emailSender.sendEmail(email, message);\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\n@Test\nvoid testNotifyUser() {\n    String email = \"test@example.com\";\n    String message = \"\u30c6\u30b9\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\";\n\n    \/\/ void\u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\n    doNothing().when(emailSender).sendEmail(email, message);\n\n    \/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n    notificationService.notifyUser(email, message);\n\n    \/\/ \u30e1\u30bd\u30c3\u30c9\u304c\u547c\u3073\u51fa\u3055\u308c\u305f\u3053\u3068\u3092\u691c\u8a3c\n    verify(emailSender).sendEmail(email, message);\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-15\">4. \u5f15\u6570\u306e\u30de\u30c3\u30c1\u30f3\u30b0\uff08ArgumentMatchers\uff09<\/h3>\n\n\n\n<p>\u67d4\u8edf\u306a\u5f15\u6570\u306e\u30de\u30c3\u30c1\u30f3\u30b0\u3092\u884c\u3046\u5834\u5408\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Test\nvoid testWithArgumentMatchers() {\n    \/\/ any()\u3092\u4f7f\u7528\u3057\u305f\u4efb\u610f\u306e\u5f15\u6570\u306e\u30de\u30c3\u30c1\u30f3\u30b0\n    when(userRepository.findByEmail(anyString()))\n        .thenReturn(new User(\"test@example.com\"));\n\n    \/\/ \u7279\u5b9a\u306e\u30d1\u30bf\u30fc\u30f3\u306b\u30de\u30c3\u30c1\u3059\u308b\u5f15\u6570\n    when(userRepository.findByEmail(matches(\".*@example\\\\.com\")))\n        .thenReturn(new User(\"test@example.com\"));\n\n    \/\/ \u6570\u5024\u7bc4\u56f2\u306e\u30de\u30c3\u30c1\u30f3\u30b0\n    when(productService.getPrice(argThat(id -&gt; id &gt; 0 &amp;&amp; id &lt; 100)))\n        .thenReturn(BigDecimal.valueOf(1000));\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-16\">5. \u30e1\u30bd\u30c3\u30c9\u547c\u3073\u51fa\u3057\u56de\u6570\u306e\u691c\u8a3c\uff08verify\uff09<\/h3>\n\n\n\n<p>\u30e1\u30bd\u30c3\u30c9\u304c\u9069\u5207\u306a\u56de\u6570\u547c\u3073\u51fa\u3055\u308c\u305f\u3053\u3068\u3092\u691c\u8a3c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Test\nvoid testVerifyMethodCalls() {\n    \/\/ \u30c6\u30b9\u30c8\u306e\u6e96\u5099\n    String email = \"test@example.com\";\n\n    \/\/ \u30e1\u30bd\u30c3\u30c9\u5b9f\u884c\n    notificationService.sendMultipleNotifications(email);\n\n    \/\/ \u691c\u8a3c\n    verify(emailSender, times(1)).sendEmail(email, \"\u521d\u56de\u901a\u77e5\");\n    verify(emailSender, times(2)).sendReminder(email);\n    verify(emailSender, never()).sendError(any());\n\n    \/\/ \u9806\u5e8f\u306e\u691c\u8a3c\n    InOrder inOrder = inOrder(emailSender);\n    inOrder.verify(emailSender).sendEmail(email, \"\u521d\u56de\u901a\u77e5\");\n    inOrder.verify(emailSender, times(2)).sendReminder(email);\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-17\">6. \u30b9\u30d1\u30a4\u3092\u4f7f\u7528\u3057\u305f\u30d1\u30fc\u30b7\u30e3\u30eb\u30e2\u30c3\u30af<\/h3>\n\n\n\n<p>\u5b9f\u969b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u4e00\u90e8\u306e\u30e1\u30bd\u30c3\u30c9\u3060\u3051\u3092\u30e2\u30c3\u30af\u5316\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Test\nvoid testWithSpy() {\n    \/\/ \u5b9f\u969b\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30b9\u30d1\u30a4\u5316\n    UserService userServiceSpy = spy(new UserService(userRepository));\n\n    \/\/ \u7279\u5b9a\u306e\u30e1\u30bd\u30c3\u30c9\u3060\u3051\u3092\u30e2\u30c3\u30af\u5316\n    doReturn(\"\u30e2\u30c3\u30af\u5024\")\n        .when(userServiceSpy)\n        .formatUserName(any());\n\n    \/\/ \u4ed6\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u5b9f\u969b\u306e\u5b9f\u88c5\u3092\u4f7f\u7528\n    String result = userServiceSpy.getUserDisplayName(1L);\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-18\">7. static \u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316<\/h3>\n\n\n\n<p>\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\u306b\u306f\u7279\u5225\u306a\u8a2d\u5b9a\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30e2\u30c3\u30af\u5316\u3057\u305f\u3044\u9759\u7684\u30e1\u30bd\u30c3\u30c9\u3092\u542b\u3080\u30af\u30e9\u30b9\npublic class DateUtils {\n    public static LocalDateTime getCurrentDateTime() {\n        return LocalDateTime.now();\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\n@Test\nvoid testStaticMethod() {\n    try (MockedStatic&lt;DateUtils&gt; dateUtils = mockStatic(DateUtils.class)) {\n        \/\/ \u9759\u7684\u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\n        dateUtils.when(DateUtils::getCurrentDateTime)\n            .thenReturn(LocalDateTime.of(2024, 1, 1, 0, 0));\n\n        \/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n        LocalDateTime result = DateUtils.getCurrentDateTime();\n\n        \/\/ \u691c\u8a3c\n        assertEquals(LocalDateTime.of(2024, 1, 1, 0, 0), result);\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-19\">8. \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u30e2\u30c3\u30af\u5316<\/h3>\n\n\n\n<p>\u65b0\u3057\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u751f\u6210\u3092\u30e2\u30c3\u30af\u5316\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Test\nvoid testConstructorMocking() {\n    \/\/ \u30e2\u30c3\u30af\u5316\u3057\u305f\u3044\u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u6e96\u5099\n    User mockUser = mock(User.class);\n    when(mockUser.getName()).thenReturn(\"\u30e2\u30c3\u30af\u30e6\u30fc\u30b6\u30fc\");\n\n    \/\/ \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u30e2\u30c3\u30af\u5316\n    try (MockedConstruction&lt;User&gt; mocked = mockConstruction(User.class,\n        (mock, context) -&gt; {\n            when(mock.getName()).thenReturn(\"\u30e2\u30c3\u30af\u30e6\u30fc\u30b6\u30fc\");\n        })) {\n\n        \/\/ \u65b0\u3057\u3044\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u6642\u306b\u30e2\u30c3\u30af\u304c\u8fd4\u3055\u308c\u308b\n        User user = new User();\n        assertEquals(\"\u30e2\u30c3\u30af\u30e6\u30fc\u30b6\u30fc\", user.getName());\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-20\">9. \u8907\u6570\u306e\u623b\u308a\u5024\u3092\u9806\u756a\u306b\u8fd4\u3059\uff08thenReturn chain\uff09<\/h3>\n\n\n\n<p>\u4e00\u3064\u306e\u30e1\u30bd\u30c3\u30c9\u547c\u3073\u51fa\u3057\u306b\u5bfe\u3057\u3066\u3001\u8907\u6570\u306e\u623b\u308a\u5024\u3092\u9806\u756a\u306b\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Test\nvoid testMultipleReturns() {\n    \/\/ \u8907\u6570\u306e\u623b\u308a\u5024\u3092\u8a2d\u5b9a\n    when(userRepository.getNextUser())\n        .thenReturn(new User(\"\u30e6\u30fc\u30b6\u30fc1\"))\n        .thenReturn(new User(\"\u30e6\u30fc\u30b6\u30fc2\"))\n        .thenReturn(new User(\"\u30e6\u30fc\u30b6\u30fc3\"));\n\n    \/\/ \u307e\u305f\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u304f\u3053\u3068\u3082\u3067\u304d\u307e\u3059\n    when(userRepository.getNextUser())\n        .thenReturn(\n            new User(\"\u30e6\u30fc\u30b6\u30fc1\"),\n            new User(\"\u30e6\u30fc\u30b6\u30fc2\"),\n            new User(\"\u30e6\u30fc\u30b6\u30fc3\")\n        );\n\n    \/\/ \u9806\u756a\u306b\u7570\u306a\u308b\u5024\u304c\u8fd4\u3055\u308c\u308b\n    assertEquals(\"\u30e6\u30fc\u30b6\u30fc1\", userRepository.getNextUser().getName());\n    assertEquals(\"\u30e6\u30fc\u30b6\u30fc2\", userRepository.getNextUser().getName());\n    assertEquals(\"\u30e6\u30fc\u30b6\u30fc3\", userRepository.getNextUser().getName());\n}<\/pre>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u8907\u96d1\u306a\u30c6\u30b9\u30c8\u30b7\u30ca\u30ea\u30aa\u306b\u3082\u5bfe\u5fdc\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3088\u304f\u4f7f\u7528\u3055\u308c\u308b\u5177\u4f53\u7684\u306a\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-21\">\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3088\u304f\u3042\u308b\u30e2\u30c3\u30af\u306e\u4f7f\u7528\u4f8b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-22\">\u5916\u90e8API\u3068\u306e\u901a\u4fe1\u51e6\u7406\u306e\u30e2\u30c3\u30af\u5316<\/h3>\n\n\n\n<p>\u5916\u90e8API\u3068\u306e\u901a\u4fe1\u306f\u3001\u30c6\u30b9\u30c8\u306e\u5b9f\u884c\u6642\u9593\u3084\u5b89\u5b9a\u6027\u306b\u5927\u304d\u304f\u5f71\u97ff\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001REST API\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u30e2\u30c3\u30af\u5316\u3059\u308b\u5b9f\u8df5\u7684\u306a\u4f8b\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ API\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\npublic interface WeatherApiClient {\n    WeatherResponse getWeatherInfo(String cityCode) throws ApiException;\n}\n\n\/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30b5\u30fc\u30d3\u30b9\n@Service\npublic class WeatherService {\n    private final WeatherApiClient apiClient;\n    private final WeatherCache cache;\n\n    public WeatherInfo getWeatherForecast(String cityCode) throws ServiceException {\n        try {\n            \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30c1\u30a7\u30c3\u30af\n            WeatherInfo cachedInfo = cache.get(cityCode);\n            if (cachedInfo != null) {\n                return cachedInfo;\n            }\n\n            \/\/ API\u547c\u3073\u51fa\u3057\n            WeatherResponse response = apiClient.getWeatherInfo(cityCode);\n            WeatherInfo weatherInfo = convertToWeatherInfo(response);\n\n            \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u4fdd\u5b58\n            cache.put(cityCode, weatherInfo);\n\n            return weatherInfo;\n        } catch (ApiException e) {\n            throw new ServiceException(\"\u5929\u6c17\u60c5\u5831\u306e\u53d6\u5f97\u306b\u5931\u6557\u3057\u307e\u3057\u305f\", e);\n        }\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\n@ExtendWith(MockitoExtension.class)\nclass WeatherServiceTest {\n    @Mock\n    private WeatherApiClient apiClient;\n\n    @Mock\n    private WeatherCache cache;\n\n    @InjectMocks\n    private WeatherService weatherService;\n\n    @Test\n    void testGetWeatherForecast_APISuccess() throws Exception {\n        \/\/ \u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\n        String cityCode = \"TOKYO\";\n        WeatherResponse mockResponse = new WeatherResponse(\"\u6674\u308c\", 25.0);\n\n        \/\/ \u30e2\u30c3\u30af\u306e\u8a2d\u5b9a\n        when(cache.get(cityCode)).thenReturn(null);  \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u30df\u30b9\n        when(apiClient.getWeatherInfo(cityCode)).thenReturn(mockResponse);\n\n        \/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n        WeatherInfo result = weatherService.getWeatherForecast(cityCode);\n\n        \/\/ \u691c\u8a3c\n        assertNotNull(result);\n        assertEquals(\"\u6674\u308c\", result.getCondition());\n        assertEquals(25.0, result.getTemperature());\n\n        \/\/ \u30ad\u30e3\u30c3\u30b7\u30e5\u4fdd\u5b58\u306e\u78ba\u8a8d\n        verify(cache).put(eq(cityCode), any(WeatherInfo.class));\n    }\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-23\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u306e\u30e2\u30c3\u30af\u5316<\/h3>\n\n\n\n<p>\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u51e6\u7406\u3092\u542b\u3080\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c\u306e\u30c6\u30b9\u30c8\u306f\u3001\u30e2\u30c3\u30af\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u52b9\u7387\u7684\u306b\u884c\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30ea\u30dd\u30b8\u30c8\u30ea\npublic interface OrderRepository extends JpaRepository&lt;Order, Long&gt; {\n    List&lt;Order&gt; findByUserId(Long userId);\n}\n\n\/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30b5\u30fc\u30d3\u30b9\n@Service\n@Transactional\npublic class OrderService {\n    private final OrderRepository orderRepository;\n    private final PaymentService paymentService;\n\n    public OrderResult processOrder(OrderRequest request) {\n        \/\/ \u6ce8\u6587\u60c5\u5831\u306e\u4fdd\u5b58\n        Order order = createOrder(request);\n        Order savedOrder = orderRepository.save(order);\n\n        \/\/ \u652f\u6255\u3044\u51e6\u7406\n        PaymentResult payment = paymentService.processPayment(\n            request.getPaymentInfo()\n        );\n\n        if (!payment.isSuccess()) {\n            throw new PaymentException(\"\u652f\u6255\u3044\u51e6\u7406\u306b\u5931\u6557\u3057\u307e\u3057\u305f\");\n        }\n\n        return new OrderResult(savedOrder.getId(), payment.getTransactionId());\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\n@Test\nvoid testProcessOrder_Success() {\n    \/\/ \u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\n    OrderRequest request = new OrderRequest(\/* \u30d1\u30e9\u30e1\u30fc\u30bf *\/);\n    Order mockOrder = new Order(\/* \u30d1\u30e9\u30e1\u30fc\u30bf *\/);\n    PaymentResult mockPayment = new PaymentResult(true, \"TRX123\");\n\n    \/\/ \u30e2\u30c3\u30af\u306e\u8a2d\u5b9a\n    when(orderRepository.save(any(Order.class))).thenReturn(mockOrder);\n    when(paymentService.processPayment(any()))\n        .thenReturn(mockPayment);\n\n    \/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n    OrderResult result = orderService.processOrder(request);\n\n    \/\/ \u691c\u8a3c\n    assertNotNull(result);\n    assertEquals(mockOrder.getId(), result.getOrderId());\n    assertEquals(\"TRX123\", result.getTransactionId());\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-24\">\u6642\u9593\u306b\u4f9d\u5b58\u3059\u308b\u51e6\u7406\u306e\u30e2\u30c3\u30af\u5316<\/h3>\n\n\n\n<p>\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u51e6\u7406\u3084\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8\u51e6\u7406\u306a\u3069\u3001\u6642\u9593\u306b\u4f9d\u5b58\u3059\u308b\u30ed\u30b8\u30c3\u30af\u306e\u30c6\u30b9\u30c8\u3067\u306f\u3001\u6642\u9593\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3067\u304d\u308b\u3088\u3046\u306b\u30e2\u30c3\u30af\u5316\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u6642\u9593\u63d0\u4f9b\u30b5\u30fc\u30d3\u30b9\npublic class TimeProvider {\n    public LocalDateTime getCurrentTime() {\n        return LocalDateTime.now();\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30b5\u30fc\u30d3\u30b9\n@Service\npublic class ReservationService {\n    private final TimeProvider timeProvider;\n\n    public boolean isReservationAvailable(\n        LocalDateTime reservationTime,\n        int maxDaysAhead\n    ) {\n        LocalDateTime currentTime = timeProvider.getCurrentTime();\n        LocalDateTime maxAllowedTime = currentTime.plusDays(maxDaysAhead);\n\n        return !reservationTime.isBefore(currentTime) \n            &amp;&amp; !reservationTime.isAfter(maxAllowedTime);\n    }\n}\n\n\/\/ \u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\n@Test\nvoid testIsReservationAvailable() {\n    \/\/ \u56fa\u5b9a\u306e\u73fe\u5728\u6642\u523b\u3092\u8a2d\u5b9a\n    LocalDateTime fixedCurrentTime = \n        LocalDateTime.of(2024, 1, 1, 10, 0);\n    when(timeProvider.getCurrentTime())\n        .thenReturn(fixedCurrentTime);\n\n    \/\/ \u4e88\u7d04\u53ef\u80fd\u306a\u6642\u9593\u5e2f\u306e\u30c6\u30b9\u30c8\n    assertTrue(reservationService.isReservationAvailable(\n        fixedCurrentTime.plusDays(2), 7));\n\n    \/\/ \u4e88\u7d04\u4e0d\u53ef\u80fd\u306a\u6642\u9593\u5e2f\u306e\u30c6\u30b9\u30c8\uff08\u671f\u9650\u8d85\u904e\uff09\n    assertFalse(reservationService.isReservationAvailable(\n        fixedCurrentTime.plusDays(8), 7));\n}<\/pre>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u5b9f\u8df5\u7684\u306a\u4f8b\u306f\u3001\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3088\u304f\u906d\u9047\u3059\u308b\u72b6\u6cc1\u306b\u57fa\u3065\u3044\u3066\u3044\u307e\u3059\u3002\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001\u30e2\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u6ce8\u610f\u70b9\u3068\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-25\">\u30e2\u30c3\u30af\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u6ce8\u610f\u70b9\u3068\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-26\">\u904e\u5ea6\u306a\u30e2\u30c3\u30af\u5316\u3092\u907f\u3051\u308b\u65b9\u6cd5<\/h3>\n\n\n\n<p>\u904e\u5ea6\u306a\u30e2\u30c3\u30af\u5316\u306f\u3001\u30c6\u30b9\u30c8\u306e\u4fdd\u5b88\u6027\u3068\u4fe1\u983c\u6027\u3092\u4f4e\u4e0b\u3055\u305b\u308b\u539f\u56e0\u3068\u306a\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30ac\u30a4\u30c9\u30e9\u30a4\u30f3\u306b\u5f93\u3063\u3066\u3001\u9069\u5207\u306a\u30e2\u30c3\u30af\u5316\u3092\u5fc3\u304c\u3051\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-27\">1. \u30e2\u30c3\u30af\u5316\u306e\u5224\u65ad\u57fa\u6e96<\/h4>\n\n\n<div id=\"id-8e0b910f-e1f8-4386-8a9a-7b6c49beff12\">\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u30e2\u30c3\u30af\u5316\u3059\u3079\u304d\u5bfe\u8c61<\/th><th>\u30e2\u30c3\u30af\u5316\u3092\u907f\u3051\u308b\u3079\u304d\u5bfe\u8c61<\/th><\/tr><\/thead><tbody><tr><td>\u5916\u90e8\u30b7\u30b9\u30c6\u30e0\u3068\u306e\u901a\u4fe1<\/td><td>\u5358\u7d14\u306aPOJO\u30af\u30e9\u30b9<\/td><\/tr><tr><td>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u64cd\u4f5c<\/td><td>\u30c9\u30e1\u30a4\u30f3\u30ed\u30b8\u30c3\u30af<\/td><\/tr><tr><td>\u30d5\u30a1\u30a4\u30ebI\/O<\/td><td>\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u51e6\u7406<\/td><\/tr><tr><td>\u6642\u9593\u4f9d\u5b58\u306e\u51e6\u7406<\/td><td>\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u30e1\u30bd\u30c3\u30c9<\/td><\/tr><tr><td>\u91cd\u3044\u51e6\u7406\uff08\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u5f71\u97ff\u5927\uff09<\/td><td>\u7d14\u7c8b\u306a\u95a2\u6570<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div>\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30a2\u30f3\u30c1\u30d1\u30bf\u30fc\u30f3\uff1a\u904e\u5ea6\u306a\u30e2\u30c3\u30af\u5316\n@Test\nvoid overMockedTest() {\n    \/\/ \u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u30af\u30e9\u30b9\u307e\u3067\u30e2\u30c3\u30af\u5316\uff08\u4e0d\u8981\uff09\n    when(StringUtils.isEmpty(anyString())).thenCallRealMethod();\n\n    \/\/ POJO\u3082\u30e2\u30c3\u30af\u5316\uff08\u4e0d\u8981\uff09\n    User mockUser = mock(User.class);\n    when(mockUser.getName()).thenReturn(\"\u30c6\u30b9\u30c8\");\n\n    \/\/ \u672c\u6765\u306e\u30c6\u30b9\u30c8...\n}\n\n\/\/ \u63a8\u5968\u30d1\u30bf\u30fc\u30f3\uff1a\u5fc5\u8981\u6700\u5c0f\u9650\u306e\u30e2\u30c3\u30af\u5316\n@Test\nvoid properlyMockedTest() {\n    \/\/ \u5b9f\u969b\u306ePOJO\u3092\u4f7f\u7528\n    User realUser = new User(\"\u30c6\u30b9\u30c8\");\n\n    \/\/ \u5916\u90e8\u4f9d\u5b58\u306e\u307f\u30e2\u30c3\u30af\u5316\n    when(userRepository.findById(1L)).thenReturn(Optional.of(realUser));\n\n    \/\/ \u672c\u6765\u306e\u30c6\u30b9\u30c8...\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-28\">\u30c6\u30b9\u30c8\u306e\u53ef\u8aad\u6027\u3092\u9ad8\u3081\u308bTips<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-29\">1. \u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3092\u660e\u78ba\u306b<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30a2\u30f3\u30c1\u30d1\u30bf\u30fc\u30f3\uff1a\u308f\u304b\u308a\u306b\u304f\u3044\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\n@Test\nvoid unclearTest() {\n    when(repository.findById(any()))\n        .thenReturn(Optional.of(new Entity(1L, \"x\", true, 100)));\n}\n\n\/\/ \u63a8\u5968\u30d1\u30bf\u30fc\u30f3\uff1a\u610f\u56f3\u304c\u660e\u78ba\u306a\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\n@Test\nvoid clearTest() {\n    \/\/ Given\n    Entity testEntity = Entity.builder()\n        .id(1L)\n        .name(\"\u30a2\u30af\u30c6\u30a3\u30d6\u30e6\u30fc\u30b6\u30fc\")\n        .active(true)\n        .score(100)\n        .build();\n\n    when(repository.findById(1L))\n        .thenReturn(Optional.of(testEntity));\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-30\">2. BDD\u30b9\u30bf\u30a4\u30eb\u306e\u30c6\u30b9\u30c8\u8a18\u8ff0<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Test\nvoid shouldProcessOrderWhenPaymentSucceeds() {\n    \/\/ Given\uff08\u524d\u63d0\u6761\u4ef6\uff09\n    OrderRequest request = createTestOrderRequest();\n    when(paymentService.processPayment(any()))\n        .thenReturn(new PaymentResult(true, \"TRX123\"));\n\n    \/\/ When\uff08\u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u5b9f\u884c\uff09\n    OrderResult result = orderService.processOrder(request);\n\n    \/\/ Then\uff08\u7d50\u679c\u306e\u691c\u8a3c\uff09\n    assertThat(result)\n        .isNotNull()\n        .satisfies(r -&gt; {\n            assertThat(r.isSuccess()).isTrue();\n            assertThat(r.getTransactionId()).isEqualTo(\"TRX123\");\n        });\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-31\">\u30e2\u30c3\u30af\u306e\u4ee3\u308f\u308a\u306b\u30b9\u30bf\u30d6\u3092\u4f7f\u3046\u3079\u304d\u30b1\u30fc\u30b9<\/h3>\n\n\n\n<p>\u5358\u7d14\u306a\u623b\u308a\u5024\u306e\u56fa\u5b9a\u3060\u3051\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u3001\u5b8c\u5168\u306a\u30e2\u30c3\u30af\u306e\u4ee3\u308f\u308a\u306b\u30b9\u30bf\u30d6\u306e\u4f7f\u7528\u3092\u691c\u8a0e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u30b9\u30bf\u30d6\u306e\u4f8b\npublic class UserRepositoryStub implements UserRepository {\n    private final Map&lt;Long, User&gt; userMap = new HashMap&lt;&gt;();\n\n    public void addUser(User user) {\n        userMap.put(user.getId(), user);\n    }\n\n    @Override\n    public Optional&lt;User&gt; findById(Long id) {\n        return Optional.ofNullable(userMap.get(id));\n    }\n\n    \/\/ \u4ed6\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u6700\u5c0f\u9650\u306e\u5b9f\u88c5\n    @Override\n    public List&lt;User&gt; findAll() {\n        return new ArrayList&lt;&gt;(userMap.values());\n    }\n}\n\n\/\/ \u30b9\u30bf\u30d6\u3092\u4f7f\u7528\u3057\u305f\u30c6\u30b9\u30c8\n@Test\nvoid testWithStub() {\n    \/\/ \u30b9\u30bf\u30d6\u306e\u6e96\u5099\n    UserRepositoryStub stub = new UserRepositoryStub();\n    stub.addUser(new User(1L, \"\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\"));\n\n    \/\/ \u30b9\u30bf\u30d6\u3092\u4f7f\u7528\u3057\u305f\u30b5\u30fc\u30d3\u30b9\u306e\u30c6\u30b9\u30c8\n    UserService service = new UserService(stub);\n    User result = service.findUser(1L);\n\n    assertThat(result)\n        .isNotNull()\n        .extracting(User::getName)\n        .isEqualTo(\"\u30c6\u30b9\u30c8\u30e6\u30fc\u30b6\u30fc\");\n}<\/pre>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u306e\u54c1\u8cea\u3068\u4fdd\u5b88\u6027\u304c\u5411\u4e0a\u3057\u3001\u30c1\u30fc\u30e0\u5168\u4f53\u306e\u958b\u767a\u52b9\u7387\u304c\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"is-style-sango-paragraph-exclamation-alt\"><strong><span class=\"big\">\u3088\u304f\u3042\u308b\u30c8\u30e9\u30d6\u30eb\u3068\u89e3\u6c7a\u65b9\u6cd5<\/span><\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-32\">NullPointerException\u304c\u767a\u751f\u3059\u308b\u5834\u5408\u306e\u5bfe\u51e6\u6cd5<\/h3>\n\n\n\n<p>\u30e2\u30c3\u30af\u3092\u4f7f\u7528\u3057\u305f\u30c6\u30b9\u30c8\u3067NullPointerException\u304c\u767a\u751f\u3059\u308b\u4e3b\u306a\u539f\u56e0\u3068\u89e3\u6c7a\u65b9\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-33\">1. \u30e2\u30c3\u30af\u306e\u521d\u671f\u5316\u5fd8\u308c<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9\npublic class UserServiceTest {\n    private UserRepository userRepository;  \/\/ @Mock\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u5fd8\u308c\n\n    @InjectMocks\n    private UserService userService;\n\n    @Test\n    void testGetUser() {\n        \/\/ NullPointerException\u767a\u751f\uff01\n        when(userRepository.findById(1L))\n            .thenReturn(Optional.of(new User()));\n    }\n}\n\n\/\/ \u89e3\u6c7a\u7b56\n@ExtendWith(MockitoExtension.class)  \/\/ \u91cd\u8981\uff01\npublic class UserServiceTest {\n    @Mock  \/\/ \u8ffd\u52a0\n    private UserRepository userRepository;\n\n    @InjectMocks\n    private UserService userService;\n\n    @Test\n    void testGetUser() {\n        \/\/ \u6b63\u5e38\u306b\u52d5\u4f5c\n        when(userRepository.findById(1L))\n            .thenReturn(Optional.of(new User()));\n    }\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-34\">2. \u6df1\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30b0\u30e9\u30d5\u306e\u51e6\u7406<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u554f\u984c\u304c\u767a\u751f\u3057\u3084\u3059\u3044\u30b1\u30fc\u30b9\n@Test\nvoid testDeepObjectGraph() {\n    when(order.getCustomer().getAddress().getCountry())\n        .thenReturn(\"\u65e5\u672c\");  \/\/ NullPointerException!\n}\n\n\/\/ \u89e3\u6c7a\u7b56\uff1a\u30c1\u30a7\u30fc\u30f3\u306e\u5404\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30e2\u30c3\u30af\u5316\n@Test\nvoid testDeepObjectGraph() {\n    Customer mockCustomer = mock(Customer.class);\n    Address mockAddress = mock(Address.class);\n\n    when(order.getCustomer()).thenReturn(mockCustomer);\n    when(mockCustomer.getAddress()).thenReturn(mockAddress);\n    when(mockAddress.getCountry()).thenReturn(\"\u65e5\u672c\");\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-35\">\u30e2\u30c3\u30af\u306e\u623b\u308a\u5024\u304c\u671f\u5f85\u901a\u308a\u3067\u306a\u3044\u5834\u5408\u306e\u78ba\u8a8d\u30dd\u30a4\u30f3\u30c8<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-36\">1. \u5f15\u6570\u306e\u30de\u30c3\u30c1\u30f3\u30b0\u554f\u984c<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9\n@Test\nvoid testArgumentMatching() {\n    User user = new User(1L, \"\u30c6\u30b9\u30c8\");\n    when(userRepository.save(user)).thenReturn(user);  \/\/ \u52d5\u4f5c\u3057\u306a\u3044\n\n    User result = userService.createUser(new User(1L, \"\u30c6\u30b9\u30c8\"));\n    \/\/ \u671f\u5f85\u3057\u305f\u623b\u308a\u5024\u304c\u8fd4\u3063\u3066\u3053\u306a\u3044\n}\n\n\/\/ \u89e3\u6c7a\u7b56\uff1a\u9069\u5207\u306a\u5f15\u6570\u30de\u30c3\u30c1\u30e3\u30fc\u3092\u4f7f\u7528\n@Test\nvoid testArgumentMatching() {\n    User user = new User(1L, \"\u30c6\u30b9\u30c8\");\n\n    \/\/ \u65b9\u6cd51\uff1aany\u3092\u4f7f\u7528\n    when(userRepository.save(any(User.class))).thenReturn(user);\n\n    \/\/ \u65b9\u6cd52\uff1a\u30ab\u30b9\u30bf\u30e0\u30de\u30c3\u30c1\u30e3\u30fc\u3092\u4f7f\u7528\n    when(userRepository.save(argThat(u -&gt; \n        u.getId().equals(1L) &amp;&amp; \n        u.getName().equals(\"\u30c6\u30b9\u30c8\")\n    ))).thenReturn(user);\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-37\">verify()\u304c\u5931\u6557\u3059\u308b\u969b\u306e\u30c7\u30d0\u30c3\u30b0\u65b9\u6cd5<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-38\">1. \u5b9f\u884c\u9806\u5e8f\u306e\u554f\u984c<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ \u554f\u984c\u306e\u3042\u308b\u30b3\u30fc\u30c9\n@Test\nvoid testVerificationOrder() {\n    \/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n    notificationService.sendNotifications();\n\n    \/\/ \u691c\u8a3c\u9806\u5e8f\u304c\u9593\u9055\u3063\u3066\u3044\u308b\n    verify(emailSender).sendReminder();\n    verify(emailSender).sendInitialEmail();  \/\/ \u5931\u6557\uff01\n}\n\n\/\/ \u89e3\u6c7a\u7b56\uff1aInOrder\u3092\u4f7f\u7528\n@Test\nvoid testVerificationOrder() {\n    \/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n    notificationService.sendNotifications();\n\n    \/\/ \u6b63\u3057\u3044\u9806\u5e8f\u3067\u691c\u8a3c\n    InOrder inOrder = inOrder(emailSender);\n    inOrder.verify(emailSender).sendInitialEmail();\n    inOrder.verify(emailSender).sendReminder();\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"i-39\">2. \u547c\u3073\u51fa\u3057\u56de\u6570\u306e\u554f\u984c<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Test\nvoid testCallCount() {\n    \/\/ \u30c6\u30b9\u30c8\u5b9f\u884c\n    for (int i = 0; i &lt; 3; i++) {\n        service.process();\n    }\n\n    \/\/ \u30c7\u30d0\u30c3\u30b0\u306e\u305f\u3081\u306e\u3088\u308a\u8a73\u7d30\u306a\u691c\u8a3c\n    verify(repository, times(3)).save(any());  \/\/ \u671f\u5f85\uff1a3\u56de\n    verify(repository, atLeast(2)).save(any()); \/\/ \u6700\u4f4e2\u56de\n    verify(repository, atMost(4)).save(any());  \/\/ \u6700\u59274\u56de\n\n    \/\/ \u5931\u6557\u6642\u306e\u30c7\u30d0\u30c3\u30b0\u60c5\u5831\n    Mockito.verifyNoMoreInteractions(repository);\n    \/\/ \u307e\u305f\u306f\n    Mockito.validateMockitoUsage();\n}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-40\">\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u305f\u3081\u306eTips<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30e2\u30c3\u30af\u306e\u632f\u308b\u821e\u3044\u306e\u78ba\u8a8d<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   \/\/ \u30e2\u30c3\u30af\u306e\u8a2d\u5b9a\u3092\u51fa\u529b\n   System.out.println(mockingDetails(userRepository).printInvocations());<\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>\u30c7\u30d0\u30c3\u30b0\u30e2\u30fc\u30c9\u306e\u6709\u52b9\u5316<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   \/\/ \u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u306e\u5148\u982d\u306b\u8ffd\u52a0\n   @Before\n   public void setup() {\n       MockitoLogger.setLogger(new ConsoleLogger());\n   }<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>\u30e2\u30c3\u30af\u306e\u691c\u8a3c\u9806\u5e8f\u306e\u30ea\u30bb\u30c3\u30c8<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">   @AfterEach\n   void tearDown() {\n       Mockito.reset(userRepository);\n   }<\/pre>\n\n\n\n<p>\u3053\u308c\u3089\u306e\u554f\u984c\u89e3\u6c7a\u30c6\u30af\u30cb\u30c3\u30af\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30e2\u30c3\u30af\u3092\u4f7f\u7528\u3057\u305f\u30c6\u30b9\u30c8\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u3092\u52b9\u7387\u7684\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-41\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>JUnit\u3068Mockito\u3092\u4f7f\u7528\u3057\u305f\u30e2\u30c3\u30af\u30c6\u30b9\u30c8\u306b\u3064\u3044\u3066\u3001\u57fa\u672c\u304b\u3089\u5b9f\u8df5\u307e\u3067\u89e3\u8aac\u3057\u3066\u304d\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u3092\u6574\u7406\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-42\">\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8\u6574\u7406<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u30e2\u30c3\u30af\u306e\u57fa\u672c\u7684\u306a\u7406\u89e3<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u30c6\u30b9\u30c8\u306e\u72ec\u7acb\u6027\u3092\u9ad8\u3081\u308b\u91cd\u8981\u306a\u30c6\u30af\u30cb\u30c3\u30af<\/li>\n\n\n\n<li>\u5916\u90e8\u4f9d\u5b58\u3092\u5206\u96e2\u3057\u3001\u30c6\u30b9\u30c8\u3092\u5b89\u5b9a\u5316<\/li>\n\n\n\n<li>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u3068\u4fe1\u983c\u6027\u306e\u5411\u4e0a\u306b\u8ca2\u732e<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5b9f\u88c5\u306e\u305f\u3081\u306e\u5177\u4f53\u7684\u306a\u30b9\u30c6\u30c3\u30d7<\/strong>\n<ul class=\"wp-block-list\">\n<li>Mockito\u306e\u9069\u5207\u306a\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u65b9\u6cd5<\/li>\n\n\n\n<li>\u57fa\u672c\u7684\u306a\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u306e\u69cb\u6210<\/li>\n\n\n\n<li>\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u6b63\u3057\u3044\u4f7f\u7528\u65b9\u6cd5<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u5b9f\u8df5\u7684\u306a\u4f7f\u7528\u30d1\u30bf\u30fc\u30f3<\/strong>\n<ul class=\"wp-block-list\">\n<li>9\u3064\u306e\u57fa\u672c\u30d1\u30bf\u30fc\u30f3\u306e\u4f7f\u3044\u5206\u3051<\/li>\n\n\n\n<li>\u5b9f\u969b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306e\u5177\u4f53\u7684\u306a\u9069\u7528\u4f8b<\/li>\n\n\n\n<li>\u5404\u30d1\u30bf\u30fc\u30f3\u306e\u5229\u70b9\u3068\u6ce8\u610f\u70b9<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u54c1\u8cea\u5411\u4e0a\u306e\u305f\u3081\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u904e\u5ea6\u306a\u30e2\u30c3\u30af\u5316\u3092\u907f\u3051\u308b<\/li>\n\n\n\n<li>\u30c6\u30b9\u30c8\u306e\u53ef\u8aad\u6027\u3092\u91cd\u8996<\/li>\n\n\n\n<li>\u30b9\u30bf\u30d6\u306e\u9069\u5207\u306a\u4f7f\u7528<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u52b9\u7387\u7684\u306a\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u4e00\u822c\u7684\u306a\u554f\u984c\u306e\u89e3\u6c7a\u65b9\u6cd5<\/li>\n\n\n\n<li>\u30c7\u30d0\u30c3\u30b0\u306e\u5177\u4f53\u7684\u306a\u624b\u9806<\/li>\n\n\n\n<li>\u4e88\u9632\u7684\u306a\u5bfe\u7b56\u306e\u5b9f\u65bd<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-43\">\u6b21\u306e\u30b9\u30c6\u30c3\u30d7<\/h3>\n\n\n\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u5b66\u3093\u3060\u5185\u5bb9\u3092\u5b9f\u8df5\u306b\u6d3b\u304b\u3059\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30c6\u30c3\u30d7\u3092\u63a8\u5968\u3057\u307e\u3059\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u65e2\u5b58\u306e\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u306e\u898b\u76f4\u3057<\/li>\n\n\n\n<li>\u30e2\u30c3\u30af\u30d1\u30bf\u30fc\u30f3\u306e\u6bb5\u968e\u7684\u306a\u5c0e\u5165<\/li>\n\n\n\n<li>\u30c1\u30fc\u30e0\u5185\u3067\u306e\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9\u306e\u5171\u6709<\/li>\n\n\n\n<li>\u7d99\u7d9a\u7684\u306a\u6539\u5584\u3068\u30d5\u30a3\u30fc\u30c9\u30d0\u30c3\u30af\u306e\u53ce\u96c6<\/li>\n<\/ol>\n\n\n\n<p>\u30e2\u30c3\u30af\u30c6\u30b9\u30c8\u306f\u3001\u73fe\u4ee3\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u306b\u304a\u3044\u3066\u4e0d\u53ef\u6b20\u306a\u30c6\u30af\u30cb\u30c3\u30af\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u89e3\u8aac\u3057\u305f\u5185\u5bb9\u3092\u57fa\u306b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u54c1\u8cea\u5411\u4e0a\u306b\u53d6\u308a\u7d44\u3093\u3067\u3044\u305f\u3060\u3051\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Warning: Undefined array key &#8220;is_admin&#8221; in \/home\/xs392991\/dexall.co.jp\/public_html\/articles\/wp-content\/themes\/ &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":{"0":"post-581","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-java","7":"nothumb"},"_links":{"self":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=581"}],"version-history":[{"count":2,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/581\/revisions"}],"predecessor-version":[{"id":588,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=\/wp\/v2\/posts\/581\/revisions\/588"}],"wp:attachment":[{"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dexall.co.jp\/articles\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}