Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitzl/hamcrest-extra
Useful matchers which are not part of the official Hamcrest.
https://github.com/bitzl/hamcrest-extra
Last synced: 17 days ago
JSON representation
Useful matchers which are not part of the official Hamcrest.
- Host: GitHub
- URL: https://github.com/bitzl/hamcrest-extra
- Owner: bitzl
- License: apache-2.0
- Created: 2016-06-04T16:56:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-06-07T05:47:45.000Z (over 8 years ago)
- Last Synced: 2024-10-28T05:13:41.317Z (about 2 months ago)
- Language: Java
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hamcrest Extra Matchers
[![Build Status](https://travis-ci.org/bitzl/hamcrest-extra.svg?branch=master)](https://travis-ci.org/bitzl/hamcrest-extra)
[![codecov](https://codecov.io/gh/bitzl/hamcrest-extra/branch/master/graph/badge.svg)](https://codecov.io/gh/bitzl/hamcrest-extra)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/27f8c549f6424a7e88240b53907e4216)](https://www.codacy.com/app/marcus_2/hamcrest-extra?utm_source=github.com&utm_medium=referral&utm_content=bitzl/hamcrest-extra&utm_campaign=Badge_Grade)
[![Apache License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)Useful matchers which are not part of the official Hamcrest.
## Usage
The `HasPropertyPath` matcher is an extension on the regular `HasProperty` matcher to test deeper nesting. This is for example useful to test Neo4j deserialization:
```java
@Test
public void shouldLoadItemClientAndPetForPetNamedPete() {
Item item = repository.loadItemClientAndPet(...);
assertThat(item, hasPropertyPath("client.pet.name", is("Pete"));
}
```In some cases, it is enough to know the path exists, no matter what value the property has:
```java
@Test
public void shouldHavePathToPetName() {
assertThat(item, hasPropertyPath("client.pet.name")); // is the same as
assertThat(item, hasPropertyPath("client.pet.name", is(anything()));
}
```# Setup
Add to your project using Maven dependency:
```xml
io.bitzl
hamcrest-extras
1.0.0-RELEASE
test
```