{"id":65,"date":"2019-05-21T10:10:41","date_gmt":"2019-05-21T01:10:41","guid":{"rendered":"http:\/\/2019se3.satoshis.jp\/?p=65"},"modified":"2019-05-24T10:19:36","modified_gmt":"2019-05-24T01:19:36","slug":"5%e6%9c%8821%e6%97%a5","status":"publish","type":"post","link":"https:\/\/2019se3.satoshis.jp\/?p=65","title":{"rendered":"5\u670821\u65e5"},"content":{"rendered":"<p>\u524d\u56de\u306f\u8fd4\u91d1\u3059\u308b\u30c6\u30b9\u30c8\u3092\u4f5c\u3063\u305f\u3068\u3053\u308d\u3067\u7d42\u308f\u3063\u3066\u3044\u305f\u306e\u3067\u3001\u307e\u305a\u306f\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u3002<br \/>\n\u3059\u308b\u3068\u3001\u8fd4\u91d1\u3059\u308b\u30c6\u30b9\u30c8\u3067\u30a8\u30e9\u30fc\u306b\u306a\u308b\u306e\u3067\u3001\u305d\u3053\u304b\u3089\u4f5c\u696d\u3092\u518d\u958b\u3059\u308c\u3070\u3044\u3044\u3053\u3068\u304c\u308f\u304b\u308b\u3002<\/p>\n<p>\u8fd4\u91d1\u3092\u5b9f\u88c5\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tpublic int refund() {\r\n\t\tint refund = total;\r\n\t\ttotal = 0;\r\n\t\treturn refund;\r\n\t}\r\n<\/pre>\n<p>\u6271\u3048\u306a\u3044\u304a\u91d1<\/p>\n<p>\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u6295\u5165\u3067\u304d\u306a\u3044\u304a\u91d1() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tvm.put(1);\r\n\t\tint total = vm.getTotal();\r\n\t\tassertThat(total, is(0));\r\n\t\tvm.put(5);\r\n\t\ttotal = vm.getTotal();\r\n\t\tassertThat(total, is(0));\r\n\t\tvm.put(20);\r\n\t\ttotal = vm.getTotal();\r\n\t\tassertThat(total, is(0));\r\n\t\tvm.put(5000);\r\n\t\ttotal = vm.getTotal();\r\n\t\tassertThat(total, is(0));\r\n\t}\r\n<\/pre>\n<p>10\u5186\u30fb50\u5186\u30fb100\u5186\u30fb500\u5186\u30fb1000\u5186\u3060\u3051\u53d7\u3051\u4ed8\u3051\u308b\u3088\u3046\u306b\u3059\u308c\u3070\u3088\u3044\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tpublic void put(int i) {\r\n\t\t\/\/ 10\u5186\u30fb50\u5186\u30fb100\u5186\u30fb500\u5186\u30fb1000\u5186\u3060\u3051\u53d7\u3051\u4ed8\u3051\u308b\r\n\t\tif (i == 10 ||\r\n\t\t\ti == 50 ||\r\n\t\t\ti == 100 ||\r\n\t\t\ti == 500 ||\r\n\t\t\ti == 1000) {\r\n\t\t\ttotal += i;\r\n\t\t}\r\n\t}\r\n<\/pre>\n<p>\u30b8\u30e5\u30fc\u30b9\u306e\u7ba1\u7406<\/p>\n<p>\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u30b8\u30e5\u30fc\u30b9\u3092\u683c\u7d0d\u3067\u304d\u308b() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tString name = vm.getJuiceName();\r\n\t\tassertThat(name, is(&quot;\u30b3\u30fc\u30e9&quot;));\r\n\t\tint price = vm.getJuicePrice();\r\n\t\tassertThat(price, is(120));\r\n\t\tint stock = vm.getJuiceStock();\r\n\t\tassertThat(stock, is(5));\r\n\t}\r\n<\/pre>\n<p>\u3053\u306e\u30c6\u30b9\u30c8\u306b\u95a2\u3057\u3066\u306f\u3001fake\u3060\u3051\u3067\u30c6\u30b9\u30c8\u306b\u30d1\u30b9\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tpublic String getJuiceName() {\r\n\t\treturn &quot;\u30b3\u30fc\u30e9&quot;;\r\n\t}\r\n\r\n\tpublic int getJuicePrice() {\r\n\t\treturn 120;\r\n\t}\r\n\r\n\tpublic int getJuiceStock() {\r\n\t\treturn 5;\r\n\t}\r\n<\/pre>\n<p>\u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3059\u308b\u3002<\/p>\n<p>\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3059\u308b() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tboolean b = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(false));\r\n\t\tvm.put(500);\r\n\t\tb = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(true));\r\n\t}\r\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u306b\u30d1\u30b9\u3059\u308b\u3088\u3046\u306b\u81ea\u52d5\u8ca9\u58f2\u6a5f\u3092\u5b9f\u88c5\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tpublic boolean canBuy(String name) {\r\n\t\treturn total &gt;= getJuicePrice();\r\n\t}\r\n<\/pre>\n<p>\u8cfc\u5165\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3059\u308b() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tboolean b = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(false));\r\n\t\tvm.put(500);\r\n\t\tb = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(true));\r\n\t\tJuice juice = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n<\/pre>\n<p>Juice\u304c\u306a\u3044\u306e\u3067\u65b0\u898f\u306b\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\npublic class Juice {\r\n\tprivate String name;\r\n\tprivate int price;\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\tpublic int getPrice() {\r\n\t\treturn price;\r\n\t}\r\n\tpublic void setPrice(int price) {\r\n\t\tthis.price = price;\r\n\t}\r\n}\r\n<\/pre>\n<p>Juice\u3092\u4f5c\u3063\u305f\u306e\u3067\u3001\u30c6\u30b9\u30c8\u306e\u7d9a\u304d\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3059\u308b() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tboolean b = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(false));\r\n\t\tvm.put(500);\r\n\t\tb = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(true));\r\n\t\tJuice juice = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(juice.getName(), is(&quot;\u30b3\u30fc\u30e9&quot;));\r\n\t}\r\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u3067\u306f\u30b8\u30e5\u30fc\u30b9\u306e\u540d\u524d\u3060\u3051\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u308b\u306e\u3067fake\u3067\u5b9f\u88c5\u3057\u3066\u304a\u304f\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tpublic Juice buy(String name) {\r\n\t\tJuice j = new Juice();\r\n\t\tj.setName(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\treturn j;\r\n\t}\r\n<\/pre>\n<p>\u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3059\u308b\u3068\u5728\u5eab\u3092\u6e1b\u3089\u3055\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u306e\u3067\u30c6\u30b9\u30c8\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3059\u308b() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tboolean b = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(false));\r\n\t\tvm.put(500);\r\n\t\tb = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(true));\r\n\t\tJuice juice = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(juice.getName(), is(&quot;\u30b3\u30fc\u30e9&quot;));\r\n\t\tint stock = vm.getJuiceStock();\r\n\t\tassertThat(stock, is(4));\r\n\t}\r\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u3092\u30d1\u30b9\u3059\u308b\u3088\u3046\u306b\u307e\u3058\u3081\u306b\u5b9f\u88c5\u3059\u308b\u3002<br \/>\nJuice\u30af\u30e9\u30b9\u306b\u306f\u3001\u5f15\u6570\u4ed8\u304d\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u304c\u6b32\u3057\u3044\u306e\u3067\u8ffd\u52a0\u3057\u3066\u304a\u304f\u3002<br \/>\n\u65e2\u5b58\u306e\u30b3\u30fc\u30c9\u3067\u5f15\u6570\u306a\u3057\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u4f7f\u3063\u3066\u3044\u308b\u306e\u3067\u5f15\u6570\u306a\u3057\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3082\u5b9a\u7fa9\u3057\u3066\u304a\u304f\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tpublic Juice(String name, int price) {\r\n\t\tthis.name = name;\r\n\t\tthis.price = price;\r\n\t}\r\n\tpublic Juice() {\r\n\t\tthis(&quot;&quot;, 0);\r\n\t}\r\n<\/pre>\n<pre class=\"brush: java; highlight: [8,12,13,14,47,55,56]; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\npublic class VendingMachine {\r\n\tprivate int total;\r\n\tprivate List&lt;Juice&gt; juices = new ArrayList&lt;&gt;();\r\n\r\n\tpublic VendingMachine() {\r\n\t\ttotal = 0;\r\n\t\tfor (int i = 0; i &lt; 5; i++) {\r\n\t\t\tjuices.add(new Juice(&quot;\u30b3\u30fc\u30e9&quot;, 120));\r\n\t\t}\r\n\t}\r\n\r\n\tpublic void put(int i) {\r\n\t\t\/\/ 10\u5186\u30fb50\u5186\u30fb100\u5186\u30fb500\u5186\u30fb1000\u5186\u3060\u3051\u53d7\u3051\u4ed8\u3051\u308b\r\n\t\tif (i == 10 ||\r\n\t\t\ti == 50 ||\r\n\t\t\ti == 100 ||\r\n\t\t\ti == 500 ||\r\n\t\t\ti == 1000) {\r\n\t\t\ttotal += i;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic int getTotal() {\r\n\t\treturn total;\r\n\t}\r\n\r\n\tpublic int refund() {\r\n\t\tint refund = total;\r\n\t\ttotal = 0;\r\n\t\treturn refund;\r\n\t}\r\n\r\n\tpublic String getJuiceName() {\r\n\t\treturn &quot;\u30b3\u30fc\u30e9&quot;;\r\n\t}\r\n\r\n\tpublic int getJuicePrice() {\r\n\t\treturn 120;\r\n\t}\r\n\r\n\tpublic int getJuiceStock() {\r\n\t\treturn juices.size();\r\n\t}\r\n\r\n\tpublic boolean canBuy(String name) {\r\n\t\treturn total &gt;= getJuicePrice();\r\n\t}\r\n\r\n\tpublic Juice buy(String name) {\r\n\t\tJuice j = juices.remove(0);\r\n\t\treturn j;\r\n\t}\r\n}\r\n<\/pre>\n<p>\u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3059\u308b\u3068\u5408\u8a08\u91d1\u984d\u304c\u6e1b\u308b\u306e\u3092\u30c6\u30b9\u30c8\u306b\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3059\u308b() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tboolean b = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(false));\r\n\t\tvm.put(500);\r\n\t\tb = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(true));\r\n\t\tJuice juice = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(juice.getName(), is(&quot;\u30b3\u30fc\u30e9&quot;));\r\n\t\tint stock = vm.getJuiceStock();\r\n\t\tassertThat(stock, is(4));\r\n\t\tint total = vm.getTotal();\r\n\t\tassertThat(total, is(380));\r\n\t}\r\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u306b\u30d1\u30b9\u3059\u308b\u3088\u3046\u306b\u5b9f\u88c5\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tpublic Juice buy(String name) {\r\n\t\tJuice j = juices.remove(0);\r\n\t\ttotal -= j.getPrice();\r\n\t\treturn j;\r\n\t}\r\n<\/pre>\n<p>\u6295\u5165\u91d1\u984d\u304c\u8db3\u308a\u306a\u3044\u3068\u304d\u306f\u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3067\u304d\u306a\u3044\u30c6\u30b9\u30c8\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u91d1\u984d\u4e0d\u8db3\u3067\u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3067\u304d\u306a\u3044() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tJuice j = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(j, is(nullValue()));\r\n\t}\r\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u306b\u30d1\u30b9\u3059\u308b\u3088\u3046\u306b\u5b9f\u88c5\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tpublic Juice buy(String name) {\r\n\t\tif (!canBuy(name)) return null;\r\n\t\tJuice j = juices.remove(0);\r\n\t\ttotal -= j.getPrice();\r\n\t\treturn j;\r\n\t}\r\n<\/pre>\n<p>\u5728\u5eab\u304c\u306a\u3044\u3068\u304d\u306f\u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3067\u304d\u306a\u3044\u30c6\u30b9\u30c8\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u5728\u5eab\u304c\u306a\u3044\u306e\u3067\u30b8\u30e5\u30fc\u30b9\u3092\u8cfc\u5165\u3067\u304d\u306a\u3044() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tvm.put(1000);\r\n\t\tfor (int i = 0; i &lt; 5; i++) {\r\n\t\t\tJuice j = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\t\tassertThat(j.getName(), is(&quot;\u30b3\u30fc\u30e9&quot;));\r\n\t\t}\r\n\t\tJuice j = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(j, is(nullValue()));\r\n\t}\r\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u306b\u30d1\u30b9\u3059\u308b\u3088\u3046\u306b\u5b9f\u88c5\u3059\u308b\u3002<br \/>\n\u5728\u5eab\u304c0\u306a\u306e\u3067\u8cfc\u5165\u3067\u304d\u306a\u3044\u3002<\/p>\n<pre class=\"brush: java; highlight: [2]; title: ; notranslate\" title=\"\">\r\n\tpublic boolean canBuy(String name) {\r\n\t\tif (juices.size() == 0) return false;\r\n\t\treturn total &gt;= getJuicePrice();\r\n\t}\r\n<\/pre>\n<p>\u58f2\u4e0a\u91d1\u984d\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002<br \/>\n\u307e\u305a\u306f\u30c6\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u73fe\u5728\u306e\u58f2\u4e0a\u91d1\u984d\u3092\u53d6\u5f97\u3067\u304d\u308b() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tint sales = vm.getSales();\r\n\t\tassertThat(sales, is(0));\r\n\t\tvm.put(1000);\r\n\t\tJuice j = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tsales = vm.getSales();\r\n\t\tassertThat(sales, is(120));\r\n\t}\r\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u306b\u30d1\u30b9\u3059\u308b\u3088\u3046\u306b\u5b9f\u88c5\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; highlight: [8,60,65]; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\npublic class VendingMachine {\r\n\tprivate int total;\r\n\tprivate int sales;\r\n\tprivate List&lt;Juice&gt; juices = new ArrayList&lt;&gt;();\r\n\r\n\tpublic VendingMachine() {\r\n\t\ttotal = 0;\r\n\t\tfor (int i = 0; i &lt; 5; i++) {\r\n\t\t\tjuices.add(new Juice(&quot;\u30b3\u30fc\u30e9&quot;, 120));\r\n\t\t}\r\n\t}\r\n\r\n\tpublic void put(int i) {\r\n\t\t\/\/ 10\u5186\u30fb50\u5186\u30fb100\u5186\u30fb500\u5186\u30fb1000\u5186\u3060\u3051\u53d7\u3051\u4ed8\u3051\u308b\r\n\t\tif (i == 10 ||\r\n\t\t\ti == 50 ||\r\n\t\t\ti == 100 ||\r\n\t\t\ti == 500 ||\r\n\t\t\ti == 1000) {\r\n\t\t\ttotal += i;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic int getTotal() {\r\n\t\treturn total;\r\n\t}\r\n\r\n\tpublic int refund() {\r\n\t\tint refund = total;\r\n\t\ttotal = 0;\r\n\t\treturn refund;\r\n\t}\r\n\r\n\tpublic String getJuiceName() {\r\n\t\treturn &quot;\u30b3\u30fc\u30e9&quot;;\r\n\t}\r\n\r\n\tpublic int getJuicePrice() {\r\n\t\treturn 120;\r\n\t}\r\n\r\n\tpublic int getJuiceStock() {\r\n\t\treturn juices.size();\r\n\t}\r\n\r\n\tpublic boolean canBuy(String name) {\r\n\t\tif (juices.size() == 0) return false;\r\n\t\treturn total &gt;= getJuicePrice();\r\n\t}\r\n\r\n\tpublic Juice buy(String name) {\r\n\t\tif (!canBuy(name)) return null;\r\n\t\tJuice j = juices.remove(0);\r\n\t\ttotal -= j.getPrice();\r\n\t\tsales += j.getPrice();\r\n\t\treturn j;\r\n\t}\r\n\r\n\tpublic int getSales() {\r\n\t\treturn sales;\r\n\t}\r\n}\r\n<\/pre>\n<p>\u8fd4\u91d1\u64cd\u4f5c\u3067\u91e3\u92ad\u3092\u8fd4\u3059\u30c6\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u8fd4\u91d1\u64cd\u4f5c\u3067\u91e3\u92ad\u3092\u8fd4\u3059() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tvm.put(1000);\r\n\t\tJuice j = vm.buy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tint refund = vm.refund();\r\n\t\tassertThat(refund, is(880));\r\n\t}\r\n<\/pre>\n<p>\u4f55\u3082\u5b9f\u88c5\u3057\u306a\u3044\u3067\u3082\u30c6\u30b9\u30c8\u306b\u30d1\u30b9\u3057\u305f\uff01\uff01\uff01\uff01\uff01\uff01\uff01<\/p>\n<p>\u6a5f\u80fd\u62e1\u5f35\u3059\u308b\u3002<\/p>\n<p>\u30b8\u30e5\u30fc\u30b9\u30923\u7a2e\u985e\u7ba1\u7406\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t@Test\r\n\tvoid \u30b8\u30e5\u30fc\u30b9\u30923\u7a2e\u985e\u7ba1\u7406\u3067\u304d\u308b() {\r\n\t\tVendingMachine vm = new VendingMachine();\r\n\t\tvm.put(100);\r\n\t\tboolean b = vm.canBuy(&quot;\u6c34&quot;);\r\n\t\tassertThat(b, is(true));\r\n\t\tb = vm.canBuy(&quot;\u30b3\u30fc\u30e9&quot;);\r\n\t\tassertThat(b, is(false));\r\n\t\tb = vm.canBuy(&quot;\u30ec\u30c3\u30c9\u30d6\u30eb&quot;);\r\n\t\tassertThat(b, is(false));\r\n\t}\r\n<\/pre>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306f\u8fd4\u91d1\u3059\u308b\u30c6\u30b9\u30c8\u3092\u4f5c\u3063\u305f\u3068\u3053\u308d\u3067\u7d42\u308f\u3063\u3066\u3044\u305f\u306e\u3067\u3001\u307e\u305a\u306f\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u3002 \u3059\u308b\u3068\u3001\u8fd4\u91d1\u3059\u308b\u30c6\u30b9\u30c8\u3067\u30a8\u30e9\u30fc\u306b\u306a\u308b\u306e\u3067\u3001\u305d\u3053\u304b\u3089\u4f5c\u696d\u3092\u518d\u958b\u3059\u308c\u3070\u3044\u3044\u3053\u3068\u304c\u308f\u304b\u308b\u3002 \u8fd4\u91d1\u3092\u5b9f\u88c5\u3059\u308b\u3002 \u6271\u3048\u306a\u3044\u304a\u91d1 \u30c6\u30b9\u30c8\u3092\u66f8\u304f\u3002 1 &hellip; <a href=\"https:\/\/2019se3.satoshis.jp\/?p=65\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;5\u670821\u65e5&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,2],"tags":[],"_links":{"self":[{"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/65"}],"collection":[{"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65"}],"version-history":[{"count":15,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/65\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/65\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}