Java (and original) version of Hamcrest

Related tags

Testing JavaHamcrest
Overview

JavaHamcrest

Build Status Maven Central

Java Hamcrest

Licensed under BSD License.

What is Hamcrest?

Hamcrest is a library of matchers, which can be combined in to create flexible expressions of intent in tests. They've also been used for other purposes.

Downloads

You can obtain Hamcrest binaries from maven central. Learn more at Hamcrest Distributables.

Extensions

For Hamcrest extension projects see the hamcrest extensions page.

Documentation

Documentation can be found on the Hamcrest site.

Reporting Bugs/Issues

If you find an issue with Java Hamcrest, please report it via the GitHub issue tracker, after first checking that it hasn't been raised already.

Source

To build, please read BUILDING.txt

Acknowledgements

Developers:

  • Joe Walnes
  • Nat Pryce
  • Steve Freeman

Contributors:

  • Robert Chatley
  • Tom White
  • Neil Dunn
  • Dan North
  • Magne Rasmussen
  • David Saff
  • Tom Denley

Also, thanks to everyone who has worked on DynaMock, nMock, jMock, EasyMock and MiniMock! These libraries inspired Hamcrest.

Comments
  • Release Version 2.1 On Maven

    Release Version 2.1 On Maven

    I can see the last artificat of Hamcrest released on maven central was back in 2015. But the latest master has many updates which are not availabe on that maven build. For example empty matcher for Map. So please release the binaries for latest master on maven central. So we can consume it in our projects. Also the latest master and binaries on maven central should be in sync.

    opened by ankurpathak 61
  • Make a release of Hamcrest 2.0.0.0

    Make a release of Hamcrest 2.0.0.0

    There have been a number of changes since hamcrest-java-1.3 was released in 2012 and, for people who use Hamcrest's binary releases, it would be good to get them into a public 1.4 release.

    There was some discussion on the mailing list back in 2013 about a Java Hamcrest 1.4 Release Plan, which suggested that #32 was the blocker for a release. However, discussion on that pull request now implies that a new release is unlikely.

    A new release would be a great resolution for this, but it would also be good to have some expectation-setting, so users can decide whether waiting, making their own releases, or forking would be their best option for getting a current Hamcrest build, or if there's any way to help out.

    opened by josephw 37
  • Maven Buildprocess

    Maven Buildprocess

    Why the JavaHamcrest is not built on Maven POM files? I guess the committers would have easier life, and it is bulletproof to deploy Maven artifacts to the Maven central repository. Some features could be maybe already accepted if the Maven build was established.

    opened by Tibor17 26
  • Decouple the evolution of Hamcrest and JUnit

    Decouple the evolution of Hamcrest and JUnit

    Evolution of Hamcrest and JUnit has been held back by the dependencies between the two projects. If they can be decoupled, both projects can move forward with less coordination required.

    Plan:

    • create a new project (hamcrest-junit, say) that contains a copy of the JUnit code that uses Hamcrest, repackaged somewhere under org.hamcrest (org.hamcrest.junit, say) so that they can live side-by-side with existing JUnit and Hamcrest code.
    • Deprecate existing code in JUnit that depends on Hamcrest
    • Perhaps deprecate Hamcrest's MatcherAssert class, now that it is duplicated in the hamcrest-junit module.
    • Eventually delete the deprecated code.
    • Run a CI "matrix" that reports the compatibility of Hamcrest and JUnit versions.

    The uses of Hamcrest in JUnit are:

    • Assert and Assume in org.junit, for which we'd have to duplicate the methods using matchers as (for instance) MatcherAssert and MatcherAssume
    • ErrorCollector and ExpectedException (and a package-protected supporting class) in org.junit.rules, which we'd have to duplicate.
    • several classes in the org.junit.internal packages, which client code should not be using
    maintainability 
    opened by npryce 23
  • Matcher checking a string matches a regular expression

    Matcher checking a string matches a regular expression

    I cannot find any class allowing me to write my tests like:

    String actual = tested.buildUrlWithRandomPort("foo", "bar");
    assertThat(actual, matchesRegex("^foo://bar:\\d+/$");
    // fails with a message like:
    // expected <foo://bar:/> to match a regular expression <^foo://bar:\d+/$>
    

    I think that Hamcrest Library should offer matchesReges() together with containsString(), endsWith() and startsWith().

    Is there a matcher like this available in the master branch? If not, I could write one (something similar to Hamcrest Regex Matcher) and create a pull request.

    enhancement 
    opened by Derbeth 20
  • The signature of isA is completely wrong

    The signature of isA is completely wrong

    public static org.hamcrest.Matcher isA(java.lang.Class type) { return org.hamcrest.core.Is.isA(type); }

    means you have to cast the thing to the type you are asserting it should be. Really it should be a matcher of anything (Object) not T.

    e.g. class hierarchy Foo extends Bar

    Bar thing = somemethod(); assertThat(thing, isA(Foo.class))

    to assert that you are getting the right subclass back - yeah ok, it might not be the best test, but anyhow......

    enhancement 
    opened by time4tea 20
  • Hamcrest should be an osgi bundle

    Hamcrest should be an osgi bundle

    I've seen discussion of this at http://code.google.com/p/hamcrest/issues/detail?id=173 , and the topic has come up in regards to doing the same for Junit (https://github.com/KentBeck/junit/issues/212). Is there any plan for this ?

    opened by rgrunber 17
  • Improve SamePropertyValuesAs to allow extension to ignore fields

    Improve SamePropertyValuesAs to allow extension to ignore fields

    Problem SamePropertyValuesAs does not support ignoring fields

    Either:

    1. change private methods to protected so the class can be enhanced to ignore certain properties, or
    2. add the feature to ignore fields in this class

    I'm willing to make the change. Please let me know if this feature is intentionally omitted.

    Thanks!

    opened by dcw312 15
  • IsUnmodifiableCollection matcher feature #249

    IsUnmodifiableCollection matcher feature #249

    My proposal of implementation of the issue #249 .

    Should work fine for both Collections::unmodifiable* implementations, and guava Immutable* collections.

    enhancement 
    opened by Andremoniy 14
  • New matcher HasSubsequence

    New matcher HasSubsequence

    When implementing a library to test compiler command-line arguments in the form:

    -x foo -y -z bar

    I found I needed a Hamcrest matcher which would look for a consecutive sequence of items anywhere inside a collection of items.

    I was surprised that Hamcrest had matchers which:

    1. Match if a collection includes a single item anywhere (hasItem)
    2. Match if a collection includes multiple items anywhere (hasItems)
    3. Match if a collection includes multiple items in order anywhere, consecutive or not (containsInRelativeOrder)
    4. Match if a collection exactly matches another collection in order (contains)
    5. Match if a collection exactly matches another collection in any order (containsInAnyOrder)

    but not for a consecutive sequence of items anywhere inside the collection.

    This implements such a matcher (hasSubsequence) and adds tests. I borrowed the tests from containsInRelativeOrder, so let me know if there are better tests I should include. I wasn't sure about the WithValue stuff so I just copy-pasted it from that test.

    enhancement 
    opened by bhamiltoncx 14
  • Boolean getter support added (Issue #138)

    Boolean getter support added (Issue #138)

    This request is to support the is prefix for Boolean object getters. Since PropertyDescriptor that is created lacks readMethod if the getter does not start with get. For example, classes that are generated by JAXB, always contain getters for Boolean types with is prefix, and without this minor fix, I cannot match those fields in any of my UT cases.

    enhancement 
    opened by buraequete 11
  • assertThat(Int::class.java, typeCompatibleWith(Number::class.java)) in kotlin always fails

    assertThat(Int::class.java, typeCompatibleWith(Number::class.java)) in kotlin always fails

    assertThat(Int::class.java, typeCompatibleWith(Number::class.java)) in kotlin always fails

    But open class Base class Extended: Base() assertThat(Extended::class.java, typeCompatibleWith(Base::class.java)) succeed

    opened by debdutta-yore 0
  • HasProperty Matcher doesn't work with Java Records

    HasProperty Matcher doesn't work with Java Records

    Describe the bug I have the following simple assertion in my test:

    hasProperty("name")
    

    For the following record:

    public record AnyDto(
        Long id,
        
        @NotBlank
        String name,
        
        String description) { }
    

    And even though I can see the object does have the property (set with a value), the test fails.

    I have tracked this down, and it seems the "issue" is generated in the PropertyUtil class, in the propertyDescriptorsFor method:

    https://github.com/hamcrest/JavaHamcrest/blob/5d76642543b4d8c3e5f1b4cd4684d31be0724fde/hamcrest/src/main/java/org/hamcrest/beans/PropertyUtil.java#L49

    This is what Introspector.getBeanInfo(fromObj.getClass(), stopClass) retrieves for a Record class:

    Screen Shot 2022-10-26 at 15 17 30

    If I change the AnyDto to a regular class, the test passes, because the Introspector method above does contain PropertyDescriptors for the class:

    Screen Shot 2022-10-26 at 15 21 48

    Note: the Record does contain name as a MethodDescriptor, maybe we can rely on these for the Records?

    This is a related Stackoverflow Question: https://stackoverflow.com/questions/66982522/how-can-i-assert-hasproperty-with-a-java-record

    opened by rozagerardo 0
  • Participitation in Hacktoberfest?

    Participitation in Hacktoberfest?

    Are you planning on participating in the Hacktoberfest? See https://hacktoberfest.com/ You would just need to add the label "hacktoberfest" to the repo.

    opened by SVNKoch 0
  • oss-fuzz integration

    oss-fuzz integration

    Hi all,

    we have prepared the Initial Integration of hamcrest into Google OSS-Fuzz which will provide more security for your project.

    Why do you need Fuzzing? The Code Intelligence JVM fuzzer Jazzer has already found hundreds of bugs in open source projects including for example OpenJDK, Protobuf or jsoup. Fuzzing proved to be very effective having no false positives. It provides a crashing input which helps you to reproduce and debug any finding easily. The integration of your project into the OSS-Fuzz platform will enable continuous fuzzing of your project by Jazzer.

    What do you need to do? The integration requires the maintainer or one established project commiter to deal with the bug reports.

    You need to create or provide one email address that is associated with a google account as per here. When a bug is found, you will receive an email that will provide you with access to ClusterFuzz, crash reports, code coverage reports and fuzzer statistics. More than 1 person can be included.

    How Code Intelligence can support? We will continue to add more fuzz targets to improve code coverage over time. Furthermore, we are permanently enhancing fuzzing technologies by developing new fuzzers and more bug detectors.

    Please let me know if you have any questions regarding fuzzing or the OSS-Fuzz integration.

    opened by aschaich 0
  • [SECURITY] Fix Temporary Directory Hijacking or Information Disclosure Vulnerability

    [SECURITY] Fix Temporary Directory Hijacking or Information Disclosure Vulnerability

    Security Vulnerability Fix

    This pull request fixes either 1.) Temporary Directory Hijacking Vulnerability, or 2.) Temporary Directory Information Disclosure Vulnerability, which existed in this project.

    Preamble

    The system temporary directory is shared between all users on most unix-like systems (not MacOS, or Windows). Thus, code interacting with the system temporary directory must be careful about file interactions in this directory, and must ensure that the correct file permissions are set.

    This PR was generated because the following chain of calls was detected in this repository in a way that leaves this project vulnerable. File.createTempFile(..) -> file.delete() -> either file.mkdir() or file.mkdirs().

    Impact

    This vulnerability can have one of two impacts depending upon which vulnerability it is.

    1. Temporary Directory Information Disclosure - Information in this directory is visable to other local users, allowing a malicious actor co-resident on the same machine to view potentially sensitive files.
    2. Temporary Directory Hijacking Vulnerability - Same impact as 1. above, but also, ther local users can manipulate/add contents to this directory. If code is being executed out of this temporary directory, it can lead to local priviledge escalation.

    Temporary Directory Hijacking

    This vulnerability exists because the return value from file.mkdir() or file.mkdirs() is not checked to determine if the call succeeded. Say, for example, because another local user created the directory before this process.

    File tmpDir = File.createTempFile("temp", ".dir"); // Attacker knows the full path of the directory that will be later created
    // delete the file that was created
    tmpDir.delete(); // Attacker sees file is deleted and begins a race to create their own directory before the java code.
    // and makes a directory of the same name
    // SECURITY VULNERABILITY: Race Condition! - Attacker beats java code and now owns this directory
    tmpDir.mkdirs(); // This method returns 'false' because it was unable to create the directory. No exception is thrown.
    // Attacker can write any new files to this directory that they wish.
    // Attacker can read any files created within this directory.
    

    Other Examples

    Temporary Directory Information Disclosure

    This vulnerability exists because, although the return values of file.mkdir() or file.mkdirs() are correctly checked, the permissions of the directory that is created follows the default system uname settings. Thus, the directory is created with everyone-readable permissions. As such, any files/directories written into this directory are viewable by all other local users on the system.

    File tmpDir = File.createTempFile("temp", ".dir");
    tmpDir.delete();
    if (!tmpDir.mkdirs()) { // Guard correctly prevents temporary directory hijacking, but directory contents are everyone-readable.
        throw new IOException("Failed to create temporary directory");
    }
    

    Other Examples

    The Fix

    The fix has been to convert the logic above to use the following API that was introduced in Java 1.7.

    File tmpDir = Files.createTempDirectory("temp dir").toFile();
    

    The API both created the directory securely, ie with a random, non-conflicting name, with directory permissions that only allow the currently executing user to read or write the contents of this directory.

    :arrow_right: Vulnerability Disclosure :arrow_left:

    :wave: Vulnerability disclosure is a super important part of the vulnerability handling process and should not be skipped! This may be completely new to you, and that's okay, I'm here to assist!

    First question, do we need to perform vulnerability disclosure? It depends!

    1. Is the vulnerable code only in tests or example code? No disclosure required!
    2. Is the vulnerable code in code shipped to your end users? Vulnerability disclosure is probably required!

    Vulnerability Disclosure How-To

    You have a few options options to perform vulnerability disclosure. However, I'd like to suggest the following 2 options:

    1. Request a CVE number from GitHub by creating a repository-level GitHub Security Advisory. This has the advantage that, if you provide sufficient information, GitHub will automatically generate Dependabot alerts for your downstream consumers, resolving this vulnerability more quickly.
    2. Reach out to the team at Snyk to assist with CVE issuance. They can be reached at the Snyk's Disclosure Email.

    Detecting this and Future Vulnerabilities

    This vulnerability was automatically detected by GitHub's LGTM.com using this CodeQL Query.

    You can automatically detect future vulnerabilities like this by enabling the free (for open-source) GitHub Action.

    I'm not an employee of GitHub, I'm simply an open-source security researcher.

    Source

    This contribution was automatically generated with an OpenRewrite refactoring recipe, which was lovingly hand crafted to bring this security fix to your repository.

    The source code that generated this PR can be found here: UseFilesCreateTempDirectory

    Opting-Out

    If you'd like to opt-out of future automated security vulnerability fixes like this, please consider adding a file called .github/GH-ROBOTS.txt to your repository with the line:

    User-agent: JLLeitschuh/security-research
    Disallow: *
    

    This bot will respect the ROBOTS.txt format for future contributions.

    Alternatively, if this project is no longer actively maintained, consider archiving the repository.

    CLA Requirements

    This section is only relevant if your project requires contributors to sign a Contributor License Agreement (CLA) for external contributions.

    It is unlikely that I'll be able to directly sign CLAs. However, all contributed commits are already automatically signed-off.

    The meaning of a signoff depends on the project, but it typically certifies that committer has the rights to submit this work under the same license and agrees to a Developer Certificate of Origin (see https://developercertificate.org/ for more information).

    - Git Commit Signoff documentation

    If signing your organization's CLA is a strict-requirement for merging this contribution, please feel free to close this PR.

    Sponsorship & Support

    This contribution is sponsored by HUMAN Security Inc. and the new Dan Kaminsky Fellowship, a fellowship created to celebrate Dan's memory and legacy by funding open-source work that makes the world a better (and more secure) place.

    This PR was generated by Moderne, a free-for-open source SaaS offering that uses format-preserving AST transformations to fix bugs, standardize code style, apply best practices, migrate library versions, and fix common security vulnerabilities at scale.

    Tracking

    All PR's generated as part of this fix are tracked here: https://github.com/JLLeitschuh/security-research/issues/10

    opened by JLLeitschuh 0
  • FR: Matching maps with various type

    FR: Matching maps with various type

    Given an actual map like this:

            Map actual = Map.of(
                    "k1", Map.of(
                            "k11", "v11",
                            "k12", "v12"),
                    "k2", List.of("v21", "v22"),
                    "k3", "V3"
            );
    

    I wish/expect to make an assertion with matcher that looks like this:

            assertThat(actual, AllOf.allOf(
                    IsMapContaining.hasEntry("k1", AllOf.allOf(
                            IsMapContaining.hasEntry("k11", "v11"),
                            IsMapContaining.hasEntry("k12", "v12"))
                    ),
                    IsMapContaining.hasEntry("k2", IsIterableContainingInOrder.contains("v21","v22")),
                    IsMapContaining.hasEntry("k3", "v3")
                    )
            );```
    
    But this fails with
    

    java: no suitable method found for allOf(org.hamcrest.Matcher<java.util.Map<? extends java.lang.String,? extends org.hamcrest.Matcher<java.util.Map<? extends java.lang.String,? extends java.lang.String>>>>,org.hamcrest.Matcher<java.util.Map<? extends java.lang.String,? extends org.hamcrest.Matcher<java.lang.Iterable<? extends java.lang.String>>>>,org.hamcrest.Matcher<java.util.Map<? extends java.lang.String,? extends java.lang.String>>) method org.hamcrest.core.AllOf.allOf(java.lang.Iterable<org.hamcrest.Matcher<? super T>>) is not applicable (cannot infer type-variable(s) T (actual and formal argument lists differ in length)) method org.hamcrest.core.AllOf.allOf(org.hamcrest.Matcher<? super T>...) is not applicable (inferred type does not conform to upper bound(s) inferred: java.util.Map<? extends java.lang.String,? extends java.lang.String> upper bound(s): java.util.Map<? extends java.lang.String,? extends java.lang.String>,java.util.Map<? extends java.lang.String,? extends org.hamcrest.Matcher<java.lang.Iterable<? extends java.lang.String>>>,java.util.Map<? extends java.lang.String,? extends org.hamcrest.Matcher<java.util.Map<? extends java.lang.String,? extends java.lang.String>>>,java.lang.Object) method org.hamcrest.core.AllOf.allOf(org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>) is not applicable (cannot infer type-variable(s) T (actual and formal argument lists differ in length)) method org.hamcrest.core.AllOf.allOf(org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>) is not applicable (inferred type does not conform to upper bound(s) inferred: java.util.Map<? extends java.lang.String,? extends java.lang.String> upper bound(s): java.util.Map<? extends java.lang.String,? extends java.lang.String>,java.util.Map<? extends java.lang.String,? extends org.hamcrest.Matcher<java.lang.Iterable<? extends java.lang.String>>>,java.util.Map<? extends java.lang.String,? extends org.hamcrest.Matcher<java.util.Map<? extends java.lang.String,? extends java.lang.String>>>,java.lang.Object) method org.hamcrest.core.AllOf.allOf(org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>) is not applicable (cannot infer type-variable(s) T (actual and formal argument lists differ in length)) method org.hamcrest.core.AllOf.allOf(org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>) is not applicable (cannot infer type-variable(s) T (actual and formal argument lists differ in length)) method org.hamcrest.core.AllOf.allOf(org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>,org.hamcrest.Matcher<? super T>) is not applicable (cannot infer type-variable(s) T (actual and formal argument lists differ in length))

    opened by jarl-dk 1
Releases(v2.2)
  • v2.2(Oct 16, 2019)

    Improvements

    • AllOf/AnyOf: Pass the matchers to constructor using varargs (Issue #245)
    • Matchers.anyOf: Fix generic bounds compatibility for JDK 11 (Issue #256, Issue #257)
    • AssertionError message is unhelpful when match fails for byte type (Issue #254, Issue #255)
    • Use platform specific line breaks (PR #267)
    • Build now checks for consistent use of spaces (PR #217)

    Bugfixes

    Source code(tar.gz)
    Source code(zip)
  • v2.2-rc1(Sep 5, 2019)

    Improvements

    • AllOf/AnyOf: Pass the matchers to constructor using varargs (Issue #245)
    • Matchers.anyOf: Fix generic bounds compatibility for JDK 11 (Issue #256, Issue #257)
    • AssertionError message is unhelpful when match fails for byte type (Issue #254, Issue #255)
    • Use platform specific line breaks (PR #267)
    • Build now checks for consistent use of spaces (PR #217)

    Bugfixes

    Source code(tar.gz)
    Source code(zip)
  • v2.1(Dec 20, 2018)

    Overview

    After a long hiatus without releases, this version simplifies the packaging of Hamcrest into a single jar: hamcrest-2.1.jar. Other big changes include Java 9 module compatibility, along with numerous other improvements and bug fixes.

    Breaking Changes

    • Although the class API has not changed since Hamcrest 1.3, the way that the project is packaged has changed. Refer to the Hamcrest Distributables documentation for more information, and in particular the section on Upgrading from Hamcrest 1.x
    • The org.hamcrest.Factory annotation has been removed (it should not be used in client code)

    Changes

    • Publish a single jar hamcrest-2.1.jar
    • Documentation updates
    • Add implementation for CharSequence length matcher
    • Fix for TypeSafeDiagnosingMatcher can't detect generic types for subclass
    • Renamed IsCollectionContaining to IsIterableContaining
    • Make Hamcrest an OSGI bundle
    • Add StringRegularExpression matcher
    • Fix StringContainsInOrder to detect if a repeated pattern is missing
    • Add ArrayAsIterableMatcher
    • Fix description for IsEqualIgnoringCase
    • Fix JavaDoc examples
    • Upgraded to Java 7
    • Build with Gradle
    • Publish a single jar java-hamcrest-2.0.0.0.jar
    • Deprecate IsCollectionContaining and IsArrayContainingXXX
    • Removed deprecated methods from previous release
    • Improve mismatch description of hasItem/hasItems
    • General improvements to mismatch descriptions
    • Several JavaDoc improvements and corrections
    • Deprecated several matcher factory methods of the for "isXyz"
    • Fix GH issue #75 - address doclint errors reported in JDK 1.8
    • Fix GH issue #69 - Iterable contains in order is null-safe
    • Fix GH issue #59 - added equalToObject() (i.e. unchecked) method
    • Fix GH issue #25 - arrayContaining(null, null) cause NullPointerException
    • Fix GH issue #36 - string matching on regular expressions
    • Fix GH issue #8 - isCloseTo() shows wrong delta in mismatch description
    • Fix GH issue #59 - add untyped version of equalTo, named equalToObject
    • Fix GC issue #131 - Implement IsEmptyMap, IsMapWithSize
    • Fix GC issue #187 - IsArray.describeMismatchSafely() should use Matcher.describeMismatch
    • Fix GC issue #155 - Add Matcher implementation for files
    • Fix GC issue #69 - fix NPE in IsIterableContainingInOrder
    Source code(tar.gz)
    Source code(zip)
  • v2.1-rc4(Dec 13, 2018)

  • v2.1-rc3(Nov 29, 2018)

    This fixes the problem that Maven has with interpreting pom-only artifacts. Both hamcrest-core and hamcrest-library artifacts now publish empty jars with a dependency on the hamcrest artifact.

    Source code(tar.gz)
    Source code(zip)
  • v2.1-rc2(Nov 27, 2018)

    This release publishes pom-only artifacts for hamcrest-core and hamcrest-library for better backwards compatibility with previous releases.

    Source code(tar.gz)
    Source code(zip)
  • v2.1-rc1(Nov 25, 2018)

    Overview

    After a long hiatus without releases, this version simplifies the packaging of Hamcrest into a single jar: hamcrest-<version>.jar. Other big changes include Java 9 module compatibility, along with numerous other improvements and bug fixes.

    Breaking Changes

    Although the class API has not changed since Hamcrest 1.3, the way that the project is packaged has changed. Refer to the Hamcrest Distributables documentation for more information.

    Changes

    • Publish a single jar hamcrest-2.1.jar
    • Documentation updates
    • Add implementation for CharSequence length matcher
    • Fix for TypeSafeDiagnosingMatcher can't detect generic types for subclass
    • Renamed IsCollectionContaining to IsIterableContaining
    • Make Hamcrest an OSGI bundle
    • Add StringRegularExpression matcher
    • Fix StringContainsInOrder to detect if a repeated pattern is missing
    • Add ArrayAsIterableMatcher
    • Fix description for IsEqualIgnoringCase
    • Fix JavaDoc examples

    Version 2.0.0.0 Changes

    Version 2.1-rc1 also includes changes previous released (but un-tagged as version 2.0.0.0). These changes include:

    • Upgraded to Java 7
    • Build with Gradle
    • Publish a single jar java-hamcrest-2.0.0.0.jar
    • Removed deprecated methods from previous release
    • Improve mismatch description of hasItem/hasItems
    • General improvements to mismatch descriptions
    • Several JavaDoc improvements and corrections
    • Deprecated several matcher factory methods of the for "isXyz"
    • Fix GH issue #75 - address doclint errors reported in JDK 1.8
    • Fix GH issue #69 - Iterable contains in order is null-safe
    • Fix GH issue #59 - added equalToObject() (i.e. unchecked) method
    • Fix GH issue #25 - arrayContaining(null, null) cause NullPointerException
    • Fix GH issue #36 - string matching on regular expressions
    • Fix GH issue #8 - isCloseTo() shows wrong delta in mismatch description
    • Fix GH issue #59 - add untyped version of equalTo, named equalToObject
    • Fix GC issue #131 - Implement IsEmptyMap, IsMapWithSize
    • Fix GC issue #187 - IsArray.describeMismatchSafely() should use Matcher.describeMismatch
    • Fix GC issue #155 - Add Matcher implementation for files
    • Fix GC issue #69 - fix NPE in IsIterableContainingInOrder
    Source code(tar.gz)
    Source code(zip)
JVM version of Pact Enables consumer driven contract testing

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.

Pact Foundation 961 Dec 30, 2022
Version informatisée du jeu "Citadelles"

?? projet2-ps5-21-22-ps5-21-22-projet2-b : Projet Citadelles Membres de l'équipe Florian Latapie Loïc Le Bris Marius Lesaulnier Thomas Paul Descriptio

Florian Latapie 3 Dec 8, 2022
Roman Beskrovnyi 248 Dec 21, 2022
A Java architecture test library, to specify and assert architecture rules in plain Java

ArchUnit is a free, simple and extensible library for checking the architecture of your Java code. That is, ArchUnit can check dependencies between pa

TNG Technology Consulting GmbH 2.5k Jan 2, 2023
Never debug a test again: Detailed failure reports and hassle free assertions for Java tests - Power Asserts for Java

Scott Test Reporter for Maven and Gradle Get extremely detailed failure messages for your tests without assertion libraries, additional configuration

Dávid Csákvári 133 Nov 17, 2022
IntelliJ IDEA and JUnit: Writing, Finding, and Running Tests

IntelliJ IDEA and JUnit: Writing, Finding, and Running Tests ?? Webinar https://blog.jetbrains.com/idea/2021/11/live-stream-recording-intellij-idea-an

Christian Stein 11 Jul 23, 2022
Library that allows tests written in Java to follow the BDD style introduced by RSpec and Jasmine.

J8Spec J8Spec is a library that allows tests written in Java to follow the BDD style introduced by RSpec and Jasmine. More details here: j8spec.github

J8Spec 45 Feb 17, 2022
A modern testing and behavioural specification framework for Java 8

Introduction If you're a Java developer and you've seen the fluent, modern specification frameworks available in other programming languages such as s

Richard Warburton 250 Sep 12, 2022
Fluent assertions for Java and Android

What is Truth? Truth makes your test assertions and failure messages more readable. Similar to AssertJ, it natively supports many JDK and Guava types,

Google 2.6k Jan 5, 2023
Playwright is a Java library to automate Chromium, Firefox and WebKit with a single API.

Playwright is a Java library to automate Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

Microsoft 634 Jan 8, 2023
A BDD-style test runner for Java 8. Inspired by Jasmine, RSpec, and Cucumber.

Spectrum A colorful BDD-style test runner for Java Spectrum is inspired by the behavior-driven testing frameworks Jasmine and RSpec, bringing their ex

Greg Haskins 143 Nov 22, 2022
Advanced Java library for integration testing, mocking, faking, and code coverage

Codebase for JMockit 1.x releases - Documentation - Release notes How to build the project: use JDK 1.8 or newer use Maven 3.6.0 or newer; the followi

The JMockit Testing Toolkit 439 Dec 9, 2022
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Rub

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).

Mock-Server 4k Jan 4, 2023
Apache JMeter - An Open Source Java application designed to measure performance and load test applications

An Open Source Java application designed to measure performance and load test applications. By The Apache Software Foundation What Is It? Apache JMete

The Apache Software Foundation 6.7k Jan 1, 2023
ScalaTest is a free, open-source testing toolkit for Scala and Java programmers

ScalaTest is a free, open-source testing toolkit for Scala and Java programmers.

ScalaTest 1.1k Dec 26, 2022
Brings the popular ruby faker gem to Java and Kotlin

Data Faker This library is a modern port of java-faker, built on Java 8, with up to date libraries and several newly added Fake Generators. This libra

null 453 Jan 7, 2023
Named and Optional parameters for Java 17

Named Parameters Named and Optional parameters for Java 17 Abstract While working on another project, I found a way to make the Java compiler attribut

Alessandro Autiero 19 Sep 30, 2022
Ready-to-use UI Test Automation Architecture using Java and Selenium WebDriver.

Selenium Test Automation Boilerplate Ready-to-use UI Test Automation Architecture using Java and Selenium WebDriver. Languages and Frameworks The proj

Tahanima Chowdhury 133 Dec 26, 2022
make async-await code style available in java just like csharp and es6

JAsync - the async-await pattern of Java 中文版 JAsync implements Async-Await pattern just like es in Java. It allows developers to write asynchronous co

null 124 Dec 26, 2022