<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ytnk531</author_name>
  <author_url>https://blog.hatena.ne.jp/ytnk531/</author_url>
  <blog_title>マイペースなRailsおじさん</blog_title>
  <blog_url>https://ytnk531.hatenablog.com/</blog_url>
  <categories>
    <anon>Mockito</anon>
  </categories>
  <description>呼び出し時の変数を使って値を返すスタブ doAnswer (かwhenのthenAnswer)を使うと、スタブの呼び出しの引数を使って返値を決めることができます。 doAnswer 例えば、スタブの返す値を引数によって変化させたいとき、引数と返値のマップを用意しておくとこのようにスタブが書けます。 doAnswer(invocation -&gt; someMap.get(invocation.getArguments()[0])) .when(mock).someMethod(anyString()); doAnswerは、Answerオブジェクトを引数にとります。 Answerクラスは、Invo…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fytnk531.hatenablog.com%2Fentry%2F2018%2F08%2F10%2F021205&quot; title=&quot;Mockitoメモ - マイペースなRailsおじさん&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-08-10 02:12:05</published>
  <title>Mockitoメモ</title>
  <type>rich</type>
  <url>https://ytnk531.hatenablog.com/entry/2018/08/10/021205</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
