Skip to content

Commit

Permalink
docs: add translate messages for #1256
Browse files Browse the repository at this point in the history
  • Loading branch information
KengoTODA committed Aug 17, 2020
1 parent 9dea534 commit 6084471
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions spotbugs/etc/messages_ja.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2005,12 +2005,47 @@ FindNullDeref ディテクタで,非 <code>null</code> 値だけが使われ
]]>
</Details>
</Detector>
<Detector class="edu.umd.cs.findbugs.detect.DontAssertInstanceofInTests">
<Details>
<![CDATA[
<p>
このディテクタは、インスタンスの型を instanceof 演算子を使って検証しているJUnitテストをチェックします。
</p>
<p>
instanceof 演算子を使うと "false is not true" という直感的でないメッセージを
伴う例外が記録されます。これは ClassCastException などよりも情報に乏しいため、他の手法を
用いることが推奨されます。
</p>
<p>このディテクタは高速に動作します。</p>
]]>
</Details>
</Detector>

<!--
**********************************************************************
BugPatterns
**********************************************************************
-->
<BugPattern type="JUA_DONT_ASSERT_INSTANCEOF_IN_TESTS">
<ShortDescription> テストコードで instanceof 演算子を用いて型を検証するのは推奨されません。 </ShortDescription>
<LongDescription> 型 {0} の検証を {2} の {3} で実行していますが、これは期待通りの挙動が確認されなかった場合に有用な情報が得られません。 </LongDescription>
<Details>
<![CDATA[
<p>
テストコードで型を instanceof 演算子を使って検証することは、ClassCastExceptionなどに比べて有用な情報が得られないため
推奨されません。
</p>
<p>
デバッグのためには <code>"false is not true"</code> のような意味のない情報よりも、
ClassCastException 例外のようにどの型がどの型にキャストできなかったのかを説明できる手法が良いでしょう。
</p>
<p>
もしJUnitをhamcrestと組み合わせて使っているのであれば、 hamcrestの<a href="https://junit.org/junit4/javadoc/latest/index.html?org/hamcrest/core/IsInstanceOf.html"><code>IsInstanceOf</code></a>
クラスを使うことが推奨されます。
</p>
]]>
</Details>
</BugPattern>

<BugPattern type="OVERRIDING_METHODS_MUST_INVOKE_SUPER">
<ShortDescription>スーパークラスのメソッドが @OverridingMethodsMustInvokeSuper で修飾されていますが, オーバーライドしているメソッドはスーパークラスのメソッドを呼び出していません。</ShortDescription>
Expand Down

0 comments on commit 6084471

Please sign in to comment.