Giter Club home page Giter Club logo

java-assertion-comparison's Introduction

Java Assertion Comparison

A project demonstrating the differences between popular assertion libraries in Java

This compares four assertion libraries:

  • JUnit Assert
  • Hamcrest
  • Google Truth
  • assertj

Usage Statistics

Acknowledging that GitHub is not the be-all, end-all exhaustive authority on what projects use these assertions, it is, nevertheless, sufficient for the needs of sampling popularity of these various assertion libraries.

Maven Dependencies

The following statistics exist for declaration of dependencies on each assertion library:

  • JUnit Assert: unfortunately, given the nature of how these assertions are embedded into the junit.jar file itself, it is not possible to distinguish between POMs that depend on JUnit for merely the ability to execute JUnit tests and those who depend on it for its assertion functionality.
  • Hamcrest: using the hamcrest-core library as the determination of yields, at time of writing this, 33,380 results for POMs and 5,393 for Gradle, for a total of 38,773. This may be a small estimation, however, as some projects, such as mockito-all bundle Hamcrest classes in with their assemblies, so there may be false negatives in projects that use libraries like mockito-all to bring in their own functionality as well as Hamcrest functionality.
  • Google Truth: using the com.google.truth group ID (since the artifact ID of "truth" is likely to result in a non-negligible amount of false positives) yields, at time of writing this, 2,535 results for POMs and 1,437 results for Gradle, for a total of 3,972.
  • assertj: using the assertj-core library as the determination of yields, at time of writing this, 30,277 results for POMs and 9,090 results for Gradle, for a total of 39,367.

Java Code Dependencies

The following statistics exist for usage of these assertion libraries in Java code, searching by import statements.

  • JUnit Assert: searching for imports of org.junit.Assert yields 3,176,406 results
  • Hamcrest: searching for imports of org.hamcrest.Matchers yields 396,818 results
  • Google Truth: searching for imports of com.google.common.truth yields 57,340 results
  • assertj: searching for imports of org.assertj.core.api yields 303,846 results

java-assertion-comparison's People

Contributors

jrh3k5 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.