我需要编写匹配器将检查多个属性。对于我用过的单个房产:匹配在一个匹配器多个属性
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasProperty;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
Matcher<Class> matcherName = Matchers.<Class> hasProperty("propertyName",equalTo(expectedValue));
我如何在一个匹配器中检查更多属性?
是,allOf是很好的方式,但我不能使用assertThat 我需要验证,如果对象run方法与预期的参数,如: '验证(模拟)。方法(argThat(matcherName));' – Szympek
@Szympek 'samePropertyValuesAs'也是'Matcher'可以分配给一个变量:'匹配器 matcherName = samePropertyValuesAs(expectedBean)' –
Ruben