当前位置: 首页>>代码示例>>Java>>正文


Java IsEqual.equalTo方法代码示例

本文整理汇总了Java中org.hamcrest.core.IsEqual.equalTo方法的典型用法代码示例。如果您正苦于以下问题:Java IsEqual.equalTo方法的具体用法?Java IsEqual.equalTo怎么用?Java IsEqual.equalTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hamcrest.core.IsEqual的用法示例。


在下文中一共展示了IsEqual.equalTo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: equalToOptional

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
public static <T> Matcher<Optional<T>> equalToOptional(final T operand) {
    return new TypeSafeMatcher<Optional<T>>() {

        private Matcher<T> equalTo;

        @Override
        protected boolean matchesSafely(Optional<T> t) {
            if(t.isPresent()) {
                equalTo = IsEqual.equalTo(t.get());
                return equalTo.matches(operand);
            }
            return false;
        }

        @Override
        public void describeTo(Description description) {
            IsEqual.equalTo(equalTo).describeTo(description);
        }
    };
}
 
开发者ID:ctco,项目名称:cukes,代码行数:21,代码来源:CustomMatchers.java

示例2: testLoadObjectsByIds_ExpectManyLoadByLongsOk

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
@Test
public void testLoadObjectsByIds_ExpectManyLoadByLongsOk() throws Exception {
	DataSetLoaderImpl fixture = buildMockedInstance();
	EasyCrudService service = Mockito.mock(EasyCrudService.class);
	when(fixture.getEasyCrudServiceResolver().resolveByEntityType("dto1")).thenReturn(service);

	Matcher<Query> matcher = IsEqual.equalTo(Query.n().in(HasId.FN_ID, new Long[] { 1L, 2L }));
	PaginatedList mockret = new PaginatedList<>(new PagerParams(), Arrays.asList(new TestDto1(), new TestDto1()),
			2);
	when(service.query(any(PagerParams.class), argThat(matcher))).thenReturn(mockret);

	List<HasId> ret = fixture.loadObjectsByIds(ids(1L, 2L), "dto1");
	assertNotNull(ret);
	assertEquals(2, ret.size());
}
 
开发者ID:skarpushin,项目名称:summerb,代码行数:16,代码来源:DataSetLoaderImplTest.java

示例3: testLoadObjectsByIds_ExpectManyLoadByStrings

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
@Test
public void testLoadObjectsByIds_ExpectManyLoadByStrings() throws Exception {
	DataSetLoaderImpl fixture = buildMockedInstance();
	EasyCrudService service = Mockito.mock(EasyCrudService.class);
	when(fixture.getEasyCrudServiceResolver().resolveByEntityType("dto1")).thenReturn(service);

	Matcher<Query> matcher = IsEqual.equalTo(Query.n().in(HasId.FN_ID, new String[] { "s1", "s2" }));
	PaginatedList mockret = new PaginatedList<>(new PagerParams(), Arrays.asList(new TestDto1(), new TestDto1()),
			2);
	when(service.query(any(PagerParams.class), argThat(matcher))).thenReturn(mockret);

	List<HasId> ret = fixture.loadObjectsByIds(ids("s1", "s2"), "dto1");
	assertNotNull(ret);
	assertEquals(2, ret.size());
}
 
开发者ID:skarpushin,项目名称:summerb,代码行数:16,代码来源:DataSetLoaderImplTest.java

示例4: matcherFor

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
private Matcher<?> matcherFor(Object value) {
	if (value instanceof Matcher<?>) {
		return (Matcher<?>) value;
	} else if (value == null) {
		return IsNull.nullValue();
	} else {
		return IsEqual.equalTo(value);
	}
}
 
开发者ID:almondtools,项目名称:xrayinterface,代码行数:10,代码来源:IsEquivalent.java

示例5: istGleich

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
public static <T> Matcher<T> istGleich(T operand) {
	return IsEqual.<T> equalTo(operand);
}
 
开发者ID:sbrannen,项目名称:spring-polyglot,代码行数:4,代码来源:TestWerkzeuge.java

示例6: equalTo

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
public static <T> Matcher<T> jestRówno(T operand) {
	return IsEqual.<T> equalTo(operand);
}
 
开发者ID:sbrannen,项目名称:spring-polyglot,代码行数:4,代码来源:NarzędziaTestowne.java

示例7: isString

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
public static Matcher<DatabaseValue> isString(String expected) {
  return IsEqual.equalTo(string(expected));
}
 
开发者ID:tonivade,项目名称:claudb,代码行数:4,代码来源:DatabaseValueMatchers.java

示例8: isList

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
public static Matcher<DatabaseValue> isList(String ... expected) {
  return IsEqual.equalTo(list(expected));
}
 
开发者ID:tonivade,项目名称:claudb,代码行数:4,代码来源:DatabaseValueMatchers.java

示例9: isSet

import org.hamcrest.core.IsEqual; //导入方法依赖的package包/类
public static Matcher<DatabaseValue> isSet(String ... expected) {
  return IsEqual.equalTo(set(expected));
}
 
开发者ID:tonivade,项目名称:claudb,代码行数:4,代码来源:DatabaseValueMatchers.java


注:本文中的org.hamcrest.core.IsEqual.equalTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。