當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。