public final class

ReflectionMatchers

extends Object
java.lang.Object
   ↳ com.atlassian.jira.matchers.ReflectionMatchers

Class Overview

Class containing static factory methods for useful reflection-based matchers.

Summary

Public Methods
static <T> Matcher<? super T> hasProperty(String chain, Matcher<?> valueMatcher)
This matcher is similar to hasProperty(String) but better!

Sometimes you need to assert on a property that is deep down in the object, and then you would do:

     hasProperty("a", hasProperty("b", hasProperty("c", equalTo("abc")))
 

But with this matcher you can just write:

     hasProperty("a.b.c", equalTo("abc"))
 

It's worth noting that the two above calls are completely equivalent, i.e.

[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static Matcher<? super T> hasProperty (String chain, Matcher<?> valueMatcher)

This matcher is similar to hasProperty(String) but better!

Sometimes you need to assert on a property that is deep down in the object, and then you would do:

     hasProperty("a", hasProperty("b", hasProperty("c", equalTo("abc")))
 

But with this matcher you can just write:

     hasProperty("a.b.c", equalTo("abc"))
 

It's worth noting that the two above calls are completely equivalent, i.e. this method is implemented in terms of hasProperty(String).

Parameters
chain property to check, can be chained (e.g. "a.b.c")
valueMatcher matcher on the property
Returns
  • the matcher