{"id":127,"date":"2017-10-21T19:53:24","date_gmt":"2017-10-21T10:53:24","guid":{"rendered":"http:\/\/ito-u-oti.com\/?p=127"},"modified":"2018-05-05T20:57:33","modified_gmt":"2018-05-05T11:57:33","slug":"post-127","status":"publish","type":"post","link":"https:\/\/ito-u-oti.com\/?p=127","title":{"rendered":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5\u30002-3.Service\u30c6\u30b9\u30c8(Junit4, mockito)"},"content":{"rendered":"<h2 id=\"outline__1\">Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5\u30002-3.Service\u30c6\u30b9\u30c8(Junit4, mockito)<\/h2>\n<div class=\"pointBox\">\u3010\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u3011<br \/>\n<a href=\"http:\/\/terasolunaorg.github.io\/guideline\/5.3.0.RELEASE\/ja\/index.html\">TERASOLUNA Server Framework for Java (5.x) Development Guideline<\/a><br \/>\n<a href=\"http:\/\/terasolunaorg.github.io\/guideline\/5.3.0.RELEASE\/ja\/Tutorial\/TutorialTodo.html\">\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u306f\u3053\u3061\u3089<\/a><br \/>\n\uff08\u3053\u308c\u306eMyBatis3\u3092\u4f7f\u7528\u3057\u305f\u30d1\u30bf\u30fc\u30f3\u3067\u4f5c\u6210\u3057\u3066\u307e\u3059\u3002\uff09<\/div>\n<h2 id=\"outline__2\">2-3.Service\u30c6\u30b9\u30c8\u3000Junit4\u3001mockito\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u305f\u30d1\u30bf\u30fc\u30f3<\/h2>\n<p>Service\u30af\u30e9\u30b9\u306e\u30c6\u30b9\u30c8\u3067\u3059\u3002<br \/>\nRepository\u30af\u30e9\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u30e2\u30c3\u30af\u5316\u3057\u3066\u30c6\u30b9\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nmockito\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u3066\u3001Repository\u30af\u30e9\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u304c\u547c\u3070\u308c\u305f\u969b\u306b\u30e2\u30c3\u30af\u7528\u306e\u623b\u308a\u5024\u3092\u8fd4\u3059\u3068\u3044\u3046\u6d41\u308c\u3067\u3059\u3002<\/p>\n<h3 id=\"outline__2_1\">\u3010pom.xml\u3011<\/h3>\n<p>Junit\u3001mockito\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;dependencies&gt;\r\n    &lt;dependency&gt;\r\n        &lt;groupId&gt;junit&lt;\/groupId&gt;\r\n        &lt;artifactId&gt;junit&lt;\/artifactId&gt;\r\n        &lt;scope&gt;test&lt;\/scope&gt;\r\n    &lt;\/dependency&gt;\r\n\r\n    &lt;dependency&gt;\r\n        &lt;groupId&gt;org.mockito&lt;\/groupId&gt;\r\n        &lt;artifactId&gt;mockito-core&lt;\/artifactId&gt;\r\n        &lt;scope&gt;test&lt;\/scope&gt;\r\n    &lt;\/dependency&gt;\r\n&lt;\/dependencies&gt;\r\n<\/pre>\n<h3 id=\"outline__2_2\">\u3010\u30c6\u30b9\u30c8\u5bfe\u8c61\u30af\u30e9\u30b9\u3011<\/h3>\n<p>TodoServiceImpl.java<br \/>\n\u30c6\u30b9\u30c8\u5bfe\u8c61\u306ffinish\u30e1\u30bd\u30c3\u30c9<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n@Service\r\n@Transactional\r\npublic class TodoServiceImpl implements TodoService {\r\n\r\n    private static final long MAX_UNFINISHED_COUNT = 5;\r\n\r\n    @Inject\r\n    TodoRepository todoRepository;\r\n\r\n    public Todo findOne(String todoId) {\r\n        Todo todo = todoRepository.findOne(todoId);\r\n        if (todo == null) {\r\n            ResultMessages messages = ResultMessages.error();\r\n            messages.add(ResultMessage.fromText(&quot;&#x5B;E004]The requested Todo is not found. (id=&quot; + todoId + &quot;)&quot;));\r\n\r\n            throw new ResourceNotFoundException(messages);\r\n        }\r\n        return todo;\r\n    }\r\n\r\n    @Override\r\n    public Todo finish(String todoId) {\r\n        \/\/ TODO \u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u30fb\u30b9\u30bf\u30d6\r\n        Todo todo = findOne(todoId);\r\n        if (todo.isFinished()) {\r\n            ResultMessages messages = ResultMessages.error();\r\n            messages.add(ResultMessage.fromText(&quot;&#x5B;E002]The requested Todo is already finished. (id=&quot; + todoId + &quot;)&quot;));\r\n\r\n            throw new BusinessException(messages);\r\n        }\r\n        todo.setFinished(true);\r\n        todoRepository.update(todo);\r\n        return todo;\r\n    }\r\n}\r\n<\/pre>\n<p>\u30e2\u30c3\u30af\u5316\u306e\u5bfe\u8c61\u30e1\u30bd\u30c3\u30c9\u306f\u3001todoRepository.update\u30e1\u30bd\u30c3\u30c9\u3068todoRepository.findOne\u30e1\u30bd\u30c3\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"outline__2_3\">\u3010\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u3011<\/h3>\n<p>TodoServiceImplTestVerMockito.java<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic class TodoServiceImplTestVerMockito {\r\n\r\n    @Rule\r\n    public MockitoRule mockito = MockitoJUnit.rule();\r\n    \r\n    @InjectMocks\r\n    TodoServiceImpl target;\r\n    \r\n    @Mock\r\n    TodoRepository todoRepository;\r\n    \r\n    @Before\r\n    public void setUp() throws Exception{\r\n        \/\/\u30e2\u30c3\u30af\u30af\u30e9\u30b9\u306e\u9069\u7528\uff08update\u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\uff09\r\n        \/\/true\u3092\u8fd4\u3059\r\n        when(todoRepository.update(anyObject())).thenReturn(true);\r\n    }\r\n    \r\n    \/\/\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u305f\u30d1\u30bf\u30fc\u30f3\r\n    @Test\r\n    public void testFinishOK() throws Exception{\r\n        \r\n        \/\/\u30e2\u30c3\u30af\u30af\u30e9\u30b9\u306e\u9069\u7528\uff08findOne\u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\uff09\r\n        \/\/todo\u306efinished\u306bfalse\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u3092\u8fd4\u3059\r\n        when(todoRepository.findOne(anyString())).thenReturn(getTodoFalseData());\r\n        \r\n        \/\/\u5f15\u6570\u8a2d\u5b9a\r\n        String todoId = &quot;cceae402-c5b1-440f-bae2-7bee19dc17fb&quot;;\r\n        \r\n        \/\/finish\u30e1\u30bd\u30c3\u30c9\u306e\u30c6\u30b9\u30c8\r\n        Todo todo = target.finish(todoId);\r\n        \r\n        \/\/\u7d50\u679c\u691c\u8a3c\uff08assertTodo\u30e1\u30bd\u30c3\u30c9\u306f\u30e1\u30bd\u30c3\u30c9\u306e\u5b9f\u884c\u306b\u3088\u3063\u3066\u8fd4\u3063\u3066\u304d\u305fTodo\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u691c\u8a3c\u3059\u308b\u30e1\u30bd\u30c3\u30c9\uff09\r\n        assertTodo(todo);\r\n        \r\n    }\r\n    \r\n    \/\/\u53d6\u5f97\u3057\u305fTodo\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306efinished\u304c\u65e2\u306btrue\u3067\u7570\u5e38\u304c\u767a\u751f\u3057\u305f\u30d1\u30bf\u30fc\u30f3\r\n    \/\/@Test\u306eexpected\u306b\u306f\u671f\u5f85\u3059\u308bException\u30af\u30e9\u30b9\u3092\u8a2d\u5b9a\u3059\u308b\u3002\u3053\u3046\u3059\u308b\u3053\u3068\u3067Exception\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u306f\u60f3\u5b9a\u901a\u308a\u3068\u3044\u3046\u3053\u3068\u3092\u5ba3\u8a00\u3057\u3066\u3044\u308b\u3002\r\n    @Test(expected = BusinessException.class)\r\n    public void testFinishNG() throws Exception{\r\n        \r\n        \/\/\u30e2\u30c3\u30af\u30af\u30e9\u30b9\u306e\u9069\u7528\uff08findOne\u30e1\u30bd\u30c3\u30c9\u306e\u30e2\u30c3\u30af\u5316\uff09\r\n        \/\/todo\u306efinished\u306btrue\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u3092\u8fd4\u3059\r\n        when(todoRepository.findOne(anyString())).thenReturn(getTodoTrueData());\r\n        \r\n        \/\/\u5f15\u6570\u8a2d\u5b9a\r\n        String todoId = &quot;cceae402-c5b1-440f-bae2-7bee19dc17fb&quot;;\r\n        \r\n        \/\/try-catch\u6587\u306f\u306a\u304f\u3066\u3082Junit\u3068\u3057\u3066\u306f\u6b63\u5e38\u306b\u306a\u308b\u304c\u3001printStackTrace\u30e1\u30bd\u30c3\u30c9\u3067\u30a8\u30e9\u30fc\u306e\u5185\u5bb9\u3092\u8868\u793a\u3055\u305b\u3066\u3044\u308b\u3002\r\n        try {\r\n            target.finish(todoId);\r\n        }catch (BusinessException e) {\r\n            \/\/ TODO: handle exception\r\n            e.printStackTrace();\r\n            \r\n            throw e;\r\n        }\r\n    }\r\n    \r\n    \/\/\u30e2\u30c3\u30af\u7528\u306e\u623b\u308a\u5024\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\uff08testFinishOK()\u7528\uff09\r\n    public Todo getTodoFalseData() throws Exception {\r\n        \r\n        Todo todo = new Todo();\r\n        todo.setTodoId(&quot;cceae402-c5b1-440f-bae2-7bee19dc17fb&quot;);\r\n        todo.setTodoTitle(&quot;one&quot;);\r\n        todo.setFinished(false);\r\n        SimpleDateFormat sdFormat = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss.SSS&quot;);\r\n        String strDate = &quot;2017-10-01 15:39:17.888&quot;;\r\n        Date date1 = sdFormat.parse(strDate);\r\n        todo.setCreatedAt(date1);\r\n        \r\n        return todo;\r\n    }\r\n    \r\n    \/\/\u30e2\u30c3\u30af\u7528\u306e\u623b\u308a\u5024\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\uff08testFinishNG()\u7528\uff09\r\n    public Todo getTodoTrueData() throws Exception {\r\n        \r\n        Todo todo = new Todo();\r\n        todo.setTodoId(&quot;cceae402-c5b1-440f-bae2-7bee19dc17fb&quot;);\r\n        todo.setTodoTitle(&quot;one&quot;);\r\n        todo.setFinished(true);\r\n        SimpleDateFormat sdFormat = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss.SSS&quot;);\r\n        String strDate = &quot;2017-10-01 15:39:17.888&quot;;\r\n        Date date1 = sdFormat.parse(strDate);\r\n        todo.setCreatedAt(date1);\r\n        \r\n        return todo;\r\n    }\r\n}\r\n<\/pre>\n<p>\u60f3\u5b9a\u901a\u308a\u306b\u30c7\u30fc\u30bf\u3092\u53d6\u3063\u3066\u304d\u305f\u6642\u306e\u30d1\u30bf\u30fc\u30f3\u3068\u3001<br \/>\n\u7570\u5e38\u304c\u767a\u751f\u3057\u305f\u6642\u306e\u30d1\u30bf\u30fc\u30f3\u306e2\u30d1\u30bf\u30fc\u30f3\u3092\u8a18\u8ff0\u3057\u307e\u3057\u305f\u3002<br \/>\n\u671f\u5f85\u901a\u308a\u306e\u7570\u5e38\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306f @Test(expected = Exception\u30af\u30e9\u30b9)\u3068\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001Junit\u306e\u30c6\u30b9\u30c8\u304c\u6210\u529f\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3 id=\"outline__2_4\">\u3010\u305d\u306e\u4ed6\u8a2d\u5b9a\u3011<\/h3>\n<p>\u7279\u306b\u306a\u3057\u3002<\/p>\n<p>\u30e2\u30c3\u30af\u30af\u30e9\u30b9\u3092\u7528\u3044\u305f\u30e2\u30c3\u30af\u5316\u3068\u6bd4\u3079\u308b\u3068\u3001\u30e2\u30c3\u30af\u7528\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u7121\u3044\u5206\u30e2\u30c3\u30af\u30af\u30e9\u30b9\u306e\u6570\u306e\u7ba1\u7406\u304c\u306a\u304f\u306a\u308b\u306e\u3067mockito\u306e\u65b9\u304c\u697d\u305d\u3046\u3067\u3059\u3002<br \/>\n\u3061\u306a\u307f\u306b\u3001mockito\u3067\u306fprivate\u30e1\u30bd\u30c3\u30c9\u3084\u3001static\u30e1\u30bd\u30c3\u30c9\u306a\u3069\u306e\u30e2\u30c3\u30af\u5316\u306f\u3067\u304d\u307e\u305b\u3093\u3002<br \/>\n\u5fc5\u8981\u306a\u3089PowerMock\u7b49\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p><span class=\"markerYellow\">\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u306fgithub\u3067\u516c\u958b\u3057\u3066\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/github.com\/itouoti12\/Spring-Unit-Test-pattern10\">Spring Unit Test pattern10<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5\u30002-3.Service\u30c6\u30b9\u30c8(Junit4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":93,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,25,52,51,24],"tags":[11,53,10,41],"class_list":["post-127","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-junit","category-maven","category-mockito","category-service-test","category-spring","tag-junit","tag-mockito","tag-spring","tag-unittest"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, moc\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"\u3044\u3068\u3068\u3044\"\/>\n\t<meta name=\"google-site-verification\" content=\"dHfPMd0QGg17gHdKjRsKPMBchJp5FPXghry3uflwfwM\" \/>\n\t<meta name=\"keywords\" content=\"spring,unittest,junit,mockito\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/ito-u-oti.com\/?p=127\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"ja_JP\" \/>\n\t\t<meta property=\"og:site_name\" content=\"\u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, mockito) | \u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1\" \/>\n\t\t<meta property=\"og:description\" content=\"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, moc\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/ito-u-oti.com\/?p=127\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2017\/10\/spring.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2017\/10\/spring.png\" \/>\n\t\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2017-10-21T10:53:24+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2018-05-05T11:57:33+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, mockito) | \u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, moc\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@itouoti_IoT\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2017\/10\/spring.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#article\",\"name\":\"Spring Framework\\u306eUnit\\u30c6\\u30b9\\u30c8\\u5b9f\\u88c5\\u65b9\\u6cd5 2-3.Service\\u30c6\\u30b9\\u30c8(Junit4, mockito) | \\u30f0\\u5200\\u306e\\u304a\\u3082\\u3061\\u3083\\u7bb1\",\"headline\":\"Spring Framework\\u306eUnit\\u30c6\\u30b9\\u30c8\\u5b9f\\u88c5\\u65b9\\u6cd5\\u30002-3.Service\\u30c6\\u30b9\\u30c8(Junit4, mockito)\",\"author\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?author=1#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/ito-u-oti.com\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/spring.png\",\"width\":900,\"height\":900},\"datePublished\":\"2017-10-21T19:53:24+09:00\",\"dateModified\":\"2018-05-05T20:57:33+09:00\",\"inLanguage\":\"ja\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#webpage\"},\"articleSection\":\"Junit, maven, mockito, Service Test, spring, Junit, mockito, spring, UnitTest\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com#listItem\",\"position\":1,\"name\":\"\\u30db\\u30fc\\u30e0\",\"item\":\"https:\\\/\\\/ito-u-oti.com\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=6#listItem\",\"name\":\"\\u30d7\\u30ed\\u30b0\\u30e9\\u30df\\u30f3\\u30b0\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=6#listItem\",\"position\":2,\"name\":\"\\u30d7\\u30ed\\u30b0\\u30e9\\u30df\\u30f3\\u30b0\",\"item\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=6\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=24#listItem\",\"name\":\"spring\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com#listItem\",\"name\":\"\\u30db\\u30fc\\u30e0\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=24#listItem\",\"position\":3,\"name\":\"spring\",\"item\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=24\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=51#listItem\",\"name\":\"Service Test\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=6#listItem\",\"name\":\"\\u30d7\\u30ed\\u30b0\\u30e9\\u30df\\u30f3\\u30b0\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=51#listItem\",\"position\":4,\"name\":\"Service Test\",\"item\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=51\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#listItem\",\"name\":\"Spring Framework\\u306eUnit\\u30c6\\u30b9\\u30c8\\u5b9f\\u88c5\\u65b9\\u6cd5\\u30002-3.Service\\u30c6\\u30b9\\u30c8(Junit4, mockito)\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=24#listItem\",\"name\":\"spring\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#listItem\",\"position\":5,\"name\":\"Spring Framework\\u306eUnit\\u30c6\\u30b9\\u30c8\\u5b9f\\u88c5\\u65b9\\u6cd5\\u30002-3.Service\\u30c6\\u30b9\\u30c8(Junit4, mockito)\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?cat=51#listItem\",\"name\":\"Service Test\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/#person\",\"name\":\"\\u3044\\u3068\\u3068\\u3044\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#personImage\",\"url\":\"https:\\\/\\\/ito-u-oti.com\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/IMG_20191231_122527_095-150x150.jpg\",\"width\":96,\"height\":96,\"caption\":\"\\u3044\\u3068\\u3068\\u3044\"},\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/itouoti_IoT\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?author=1#author\",\"url\":\"https:\\\/\\\/ito-u-oti.com\\\/?author=1\",\"name\":\"\\u3044\\u3068\\u3068\\u3044\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#authorImage\",\"url\":\"https:\\\/\\\/ito-u-oti.com\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/IMG_20191231_122527_095-150x150.jpg\",\"width\":96,\"height\":96,\"caption\":\"\\u3044\\u3068\\u3068\\u3044\"},\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/itouoti_IoT\"]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#webpage\",\"url\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127\",\"name\":\"Spring Framework\\u306eUnit\\u30c6\\u30b9\\u30c8\\u5b9f\\u88c5\\u65b9\\u6cd5 2-3.Service\\u30c6\\u30b9\\u30c8(Junit4, mockito) | \\u30f0\\u5200\\u306e\\u304a\\u3082\\u3061\\u3083\\u7bb1\",\"description\":\"Spring Framework\\u306eUnit\\u30c6\\u30b9\\u30c8\\u5b9f\\u88c5\\u65b9\\u6cd5 2-3.Service\\u30c6\\u30b9\\u30c8(Junit4, moc\",\"inLanguage\":\"ja\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?author=1#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?author=1#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/ito-u-oti.com\\\/wp-content\\\/uploads\\\/2017\\\/10\\\/spring.png\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127\\\/#mainImage\",\"width\":900,\"height\":900},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/?p=127#mainImage\"},\"datePublished\":\"2017-10-21T19:53:24+09:00\",\"dateModified\":\"2018-05-05T20:57:33+09:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/#website\",\"url\":\"https:\\\/\\\/ito-u-oti.com\\\/\",\"name\":\"\\u30f0\\u5200\\u306e\\u304a\\u3082\\u3061\\u3083\\u7bb1\",\"description\":\"music\\u00d7IT\\u00d7guiter\\u00d7programing\",\"inLanguage\":\"ja\",\"publisher\":{\"@id\":\"https:\\\/\\\/ito-u-oti.com\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, mockito) | \u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1","description":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, moc","canonical_url":"https:\/\/ito-u-oti.com\/?p=127","robots":"max-image-preview:large","keywords":"spring,unittest,junit,mockito","webmasterTools":{"google-site-verification":"dHfPMd0QGg17gHdKjRsKPMBchJp5FPXghry3uflwfwM","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ito-u-oti.com\/?p=127#article","name":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, mockito) | \u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1","headline":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5\u30002-3.Service\u30c6\u30b9\u30c8(Junit4, mockito)","author":{"@id":"https:\/\/ito-u-oti.com\/?author=1#author"},"publisher":{"@id":"https:\/\/ito-u-oti.com\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2017\/10\/spring.png","width":900,"height":900},"datePublished":"2017-10-21T19:53:24+09:00","dateModified":"2018-05-05T20:57:33+09:00","inLanguage":"ja","mainEntityOfPage":{"@id":"https:\/\/ito-u-oti.com\/?p=127#webpage"},"isPartOf":{"@id":"https:\/\/ito-u-oti.com\/?p=127#webpage"},"articleSection":"Junit, maven, mockito, Service Test, spring, Junit, mockito, spring, UnitTest"},{"@type":"BreadcrumbList","@id":"https:\/\/ito-u-oti.com\/?p=127#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com#listItem","position":1,"name":"\u30db\u30fc\u30e0","item":"https:\/\/ito-u-oti.com","nextItem":{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=6#listItem","name":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0"}},{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=6#listItem","position":2,"name":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0","item":"https:\/\/ito-u-oti.com\/?cat=6","nextItem":{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=24#listItem","name":"spring"},"previousItem":{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com#listItem","name":"\u30db\u30fc\u30e0"}},{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=24#listItem","position":3,"name":"spring","item":"https:\/\/ito-u-oti.com\/?cat=24","nextItem":{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=51#listItem","name":"Service Test"},"previousItem":{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=6#listItem","name":"\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0"}},{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=51#listItem","position":4,"name":"Service Test","item":"https:\/\/ito-u-oti.com\/?cat=51","nextItem":{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?p=127#listItem","name":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5\u30002-3.Service\u30c6\u30b9\u30c8(Junit4, mockito)"},"previousItem":{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=24#listItem","name":"spring"}},{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?p=127#listItem","position":5,"name":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5\u30002-3.Service\u30c6\u30b9\u30c8(Junit4, mockito)","previousItem":{"@type":"ListItem","@id":"https:\/\/ito-u-oti.com\/?cat=51#listItem","name":"Service Test"}}]},{"@type":"Person","@id":"https:\/\/ito-u-oti.com\/#person","name":"\u3044\u3068\u3068\u3044","image":{"@type":"ImageObject","@id":"https:\/\/ito-u-oti.com\/?p=127#personImage","url":"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2021\/06\/IMG_20191231_122527_095-150x150.jpg","width":96,"height":96,"caption":"\u3044\u3068\u3068\u3044"},"sameAs":["https:\/\/twitter.com\/itouoti_IoT"]},{"@type":"Person","@id":"https:\/\/ito-u-oti.com\/?author=1#author","url":"https:\/\/ito-u-oti.com\/?author=1","name":"\u3044\u3068\u3068\u3044","image":{"@type":"ImageObject","@id":"https:\/\/ito-u-oti.com\/?p=127#authorImage","url":"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2021\/06\/IMG_20191231_122527_095-150x150.jpg","width":96,"height":96,"caption":"\u3044\u3068\u3068\u3044"},"sameAs":["https:\/\/twitter.com\/itouoti_IoT"]},{"@type":"WebPage","@id":"https:\/\/ito-u-oti.com\/?p=127#webpage","url":"https:\/\/ito-u-oti.com\/?p=127","name":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, mockito) | \u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1","description":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, moc","inLanguage":"ja","isPartOf":{"@id":"https:\/\/ito-u-oti.com\/#website"},"breadcrumb":{"@id":"https:\/\/ito-u-oti.com\/?p=127#breadcrumblist"},"author":{"@id":"https:\/\/ito-u-oti.com\/?author=1#author"},"creator":{"@id":"https:\/\/ito-u-oti.com\/?author=1#author"},"image":{"@type":"ImageObject","url":"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2017\/10\/spring.png","@id":"https:\/\/ito-u-oti.com\/?p=127\/#mainImage","width":900,"height":900},"primaryImageOfPage":{"@id":"https:\/\/ito-u-oti.com\/?p=127#mainImage"},"datePublished":"2017-10-21T19:53:24+09:00","dateModified":"2018-05-05T20:57:33+09:00"},{"@type":"WebSite","@id":"https:\/\/ito-u-oti.com\/#website","url":"https:\/\/ito-u-oti.com\/","name":"\u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1","description":"music\u00d7IT\u00d7guiter\u00d7programing","inLanguage":"ja","publisher":{"@id":"https:\/\/ito-u-oti.com\/#person"}}]},"og:locale":"ja_JP","og:site_name":"\u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1","og:type":"article","og:title":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, mockito) | \u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1","og:description":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, moc","og:url":"https:\/\/ito-u-oti.com\/?p=127","og:image":"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2017\/10\/spring.png","og:image:secure_url":"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2017\/10\/spring.png","og:image:width":900,"og:image:height":900,"article:published_time":"2017-10-21T10:53:24+00:00","article:modified_time":"2018-05-05T11:57:33+00:00","twitter:card":"summary","twitter:title":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, mockito) | \u30f0\u5200\u306e\u304a\u3082\u3061\u3083\u7bb1","twitter:description":"Spring Framework\u306eUnit\u30c6\u30b9\u30c8\u5b9f\u88c5\u65b9\u6cd5 2-3.Service\u30c6\u30b9\u30c8(Junit4, moc","twitter:creator":"@itouoti_IoT","twitter:image":"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2017\/10\/spring.png"},"aioseo_meta_data":{"post_id":"127","title":null,"description":null,"keywords":[{"label":"spring","value":"spring"},{"label":"UnitTest","value":"UnitTest"},{"label":"Junit","value":"Junit"},{"label":"mockito","value":"mockito"}],"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"article","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-04-11 14:09:28","updated":"2025-06-04 05:44:48","seo_analyzer_scan_date":null},"_links":{"self":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=127"}],"version-history":[{"count":5,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/127\/revisions"}],"predecessor-version":[{"id":442,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/127\/revisions\/442"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/media\/93"}],"wp:attachment":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}