<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>atr0phy</author_name>
  <author_url>https://blog.hatena.ne.jp/atr0phy/</author_url>
  <blog_title>HackToTech</blog_title>
  <blog_url>https://www.hacktotech.net/</blog_url>
  <categories>
    <anon>kotlin</anon>
    <anon>mockito</anon>
  </categories>
  <description>kotlin 書いてて、mockito-inline の mockStatic を使おうとして 少し時間無駄にしたので、他の人が同じことで時間を無駄にしないように書いとく tl;dr @JvmStatic のAnnotationをつける必要がある 普通に考えれば当たり前なんだけど、つけ忘れてた時にエラー出てなんでだっけ？ってなる object ExampleObject { @JvmStatic //これ fun static(): String { return &quot;static&quot; } } なぜか じゃないとバイトコードになった時に static にならないので結果としてmock出来ずに失敗す…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.hacktotech.net%2Fentry%2Fkotlin-mockito-mock-static&quot; title=&quot;KotlinでmockStaticを使おうとしてちょっとハマった話 - HackToTech&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>https://cdn-ak.f.st-hatena.com/images/fotolife/a/atr0phy/20220724/20220724155908.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-04-03 01:49:23</published>
  <title>KotlinでmockStaticを使おうとしてちょっとハマった話</title>
  <type>rich</type>
  <url>https://www.hacktotech.net/entry/kotlin-mockito-mock-static</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
