{"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkenkoooo.hatenablog.com%2Fentry%2F2021%2F12%2F06%2F125825\" title=\"Put &quot;open&quot; to your class and its method when you get a NullPointerException by mocking your class by Mockito. - \u5b87\u5b99\u30c4\u30a4\u30c3\u30bf\u30e9\u30fcX\u306e\u6182\u9b31\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","blog_title":"\u5b87\u5b99\u30c4\u30a4\u30c3\u30bf\u30e9\u30fcX\u306e\u6182\u9b31","provider_name":"Hatena Blog","height":"190","author_url":"https://blog.hatena.ne.jp/kenkoooo/","image_url":null,"author_name":"kenkoooo","provider_url":"https://hatena.blog","version":"1.0","categories":[],"blog_url":"https://kenkoooo.hatenablog.com/","width":"100%","description":"Problem When you have MyClass and try to write a test by mocking MyClass as the following, you will get an NPE: MyClass: open class MyClass { fun createList(string: String): List<String> { return listOf(\"A\", \"B\", \"C\", string) } } Mocking MyClass by Mockito: import org.junit.jupiter.api.Test import o\u2026","published":"2021-12-06 12:58:25","type":"rich","title":"Put \"open\" to your class and its method when you get a NullPointerException by mocking your class by Mockito.","url":"https://kenkoooo.hatenablog.com/entry/2021/12/06/125825"}