並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 14 件 / 14件

新着順 人気順

AssertJの検索結果1 - 14 件 / 14件

  • JavaのテストにはAssertJがオススメ - Qiita

    JavaでのテストはJUnit4が使われていると思いますが、自分としては、それに加えてAssertJをオススメします。 AssertJ AssertJが使いやすい理由 JUnit4のassertThatと比べてAssertJが使いやすい理由は2つあります。 流れるようなインターフェース AssertJは「Fluent assertions for java」とトップページに大きく書かれているように、流れるようなインターフェースが最大の特徴です。いちいちドキュメントを調べなくても、IDEの補完機能で適切なメソッドを調べられるので、JUnit4のassertThatに比べて書きやすいです。 拡張がMatcherに比べて遥かに楽 Matcherの拡張対象は「比較方法」で、AssertJの拡張対象は「クラス」なので比較するのは適切ではないかもしれませんが、Matcherの拡張が靴の上から足を掻く感

      JavaのテストにはAssertJがオススメ - Qiita
    • AssertJ 使い方メモ - Qiita

      package sample.assertj; import org.junit.Test; import static org.assertj.core.api.Assertions.*; public class MainTest { @Test public void test() { assertThat("hoge").isEqualTo("Hoge"); } } org.junit.ComparisonFailure: expected:<"[H]oge"> but was:<"[h]oge"> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstru

        AssertJ 使い方メモ - Qiita
      • AssertJ / Fluent assertions for java

        AssertJ Core site has moved to https://assertj.github.io/doc/ This site is still maintained for AssertJ modules (until their documentation is migrated) Rich and easy to use AssertJ provides a rich set of assertions, truly helpful error messages, improves test code readability and is designed to be super easy to use within your favorite IDE. Get started right away with the one minute starting guide

        • JUnitのアサーションライブラリHamcrest,AssertJ比較 - Qiita

          なぜ今アサーション? 現時点でJUnit5ではHamcrestのMatcherは提供せず、使用者が自由に選択する方針で進んでいます。 そうなった場合、標準でサポートされるassertTrueやassertEquelsなどだけでは、ちょっと頼りなく車輪の再発明になりそうなので、候補になりそうなHamcrestとAssertJのよく使いそうなメソッド比較表を作りました。 Google Truthも気になるところなので、時間があれば追加しようと思います。 尚、FESTは現時点で更新がストップしているようなので候補から除外しています。

            JUnitのアサーションライブラリHamcrest,AssertJ比較 - Qiita
          • Java のアサーションライブラリ AssertJ の時代が来そうな予感 - にょきにょきブログ

            Java のアサーションライブラリに AssertJ というものがある。 http://joel-costigliola.github.io/assertj/ Fluent にアサーションが書けるとのことなので、我がプロジェクトに導入してみました。 基本 基本的な比較。 Junit, Mockito だとこういう風に書くケースが・・・ assertEquals(expect, value); // JUnit assertThat(value, is(expect)); // Mockito こう書けます。 assertThat(value).isEqualsTo(expect); // AssertJ 「何が嬉しいの?」と思うかもしれませんが、とりあえず先に進みましょう。 文字列比較 よくある比較。コードの意図は説明しなくとも伝わると思います。 assertThat("Hello Wor

              Java のアサーションライブラリ AssertJ の時代が来そうな予感 - にょきにょきブログ
            • ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て

              ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て - Download as a PDF or view online for free

                ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
              • AssertJを使って、テストコードを書く - CLOVER🍀

                以前書いたエントリ、 Fest Assertionsを使って、テストコードを書く http://d.hatena.ne.jp/Kazuhira/20131224/1387895002 をAssertJで書き直した、焼き直しみたいなエントリです。 以前、Fest Assertionsを使ってから、個人的に書くテストコードにはFest Assertionsを使っていたのですが、開発が停止状態?にあることと、その後継的なものとしてAssertJがあることに気付いてはいたのですが、長らく放ったらかしにしていました…。 いい加減、試してみようかということで。 AssertJ http://joel-costigliola.github.io/assertj/ Fest Assertionsと同様、JUnitおよびTestNGと一緒に使えるみたいです。 また、Fest Assertionsからのマイグ

                  AssertJを使って、テストコードを書く - CLOVER🍀
                • AssertJ版:テストでよく使う検証メソッド一覧 - Qiita

                  はじめに AssertJ ~Fluent assertions for java~ JUnit でよく使う Matcher はこちらによくまとまっています。 HamcrestのMatchersに定義されているメソッドの使い方メモ 今回はこれの AssertJ 版的な位置づけで用意してみようと思います。 ただし、全ての検証メソッドを網羅しているわけではありませんので、その点についてはご容赦下さい。 バージョン

                    AssertJ版:テストでよく使う検証メソッド一覧 - Qiita
                  • AssertJ / Fluent assertions for java

                    AssertJ Core site has moved to https://assertj.github.io/doc/ This site is still maintained for AssertJ modules (until their documentation is migrated) Rich and easy to use AssertJ provides a rich set of assertions, truly helpful error messages, improves test code readability and is designed to be super easy to use within your favorite IDE. Get started right away with the one minute starting guide

                    • GitHub - square/assertj-android: A set of AssertJ helpers geared toward testing Android.

                      You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                        GitHub - square/assertj-android: A set of AssertJ helpers geared toward testing Android.
                      • AssertJ 用の IntelliJ postfix completion plugin を書いた - tokuhirom's blog

                        AssertJ の assertThat() をpostfix completion で入力したいと常々思っていて、誰か書いてくれないかなと思っていたけど誰も書いてくれないし、IntelliJ のプラグインというものを書いてみたかったので書いてみた。 https://github.com/tokuhirom/assertj-postfix-plugin ↑レポジトリはこちら。 IntelliJ のプラグインの情報は少なくて、どうもどこが本家なのかよくわからなかった。 http://www.jetbrains.org/intellij/sdk/docs/index.html たぶんこの辺。だと思う。 とりあえず検索してみたところ IntelliJ IDEAのPostfix補完プラグインを作るという記事が見つかったので、「こりゃあ、真似すれば簡単に実装できそうだなー」と思ったのが運の尽き。 ど

                        • Unit testing with Mockito and AssertJ

                          Unit testing with Mockito and AssertJ January 31st, 2015 7 minute read AssertJ JUnit Mockito Testing A few weeks ago I wrote my very first Spring Boot application and I was quite astonished about the result. Now, I did want to complete the application by writing some tests and so I did. In my previous tutorial I wrote several integration tests, and now it’s time to write some unit tests as well. F

                            Unit testing with Mockito and AssertJ
                          • AssertJ - fluent assertions java library

                            A core module to provide assertions for JDK types (String, Iterable, Stream, Path, File, Map, …​) A Guava module to provide assertions for Guava types (Multimap, Optional, …​) A Joda Time module to provide assertions for Joda Time types (DateTime, LocalDateTime) A Neo4J module to provide assertions for Neo4J types (Path, Node, Relationship, …​) A DB module to provide assertions for relational data

                            • DbsetupとAssertJ-DBでDBのテスト - Qiita

                              JavaでDBのテスト 実際のテストでめんどいDBのテストデータの準備とDBの状態のテスト。これまではDBUnitしか使ったことなかったけど、Dbsetupでテストデータを準備し、AssertJ,AssertJ-DBでDBのテストをやってみた。 DBUnit http://dbunit.sourceforge.net/intro.html データを外部ファイルで管理して、Assertionも期待値を格納したファイルと比較して書ける。 // Fetch database data after executing your code IDataSet databaseDataSet = getConnection().createDataSet(); ITable actualTable = databaseDataSet.getTable("TABLE_NAME"); // Load exp

                                DbsetupとAssertJ-DBでDBのテスト - Qiita
                              1