hamcrest (1.3.RC2、JUnit 依存関係なし) で使用に失敗していますiterableWithSize().
私はこのよう
にIterator
パラメータ化された(の拡張)を持っていますContent
EndResult<Content> contents = contentRepository.findAllByPropertyValue("title", "*content*");
私のPojoはどこにEndResult
あり
package org.springframework.data.neo4j.conversion;
public interface EndResult<R> extends Iterable<R> {...}
ますか。Content
今、私はこれがうまくいくと思うでしょう
assertThat(contents, iterableWithSize(1));
しかし、それは私にエラーを与えます: タイプ Assert のメソッド assertThat(T, Matcher) は、引数 (EndResult< Content>, Matcher< Iterable< Object>>) には適用できません
私もこれらの失敗を試しました:
assertThat(contents, iterableWithSize(equalTo(1));
assertThat(contents, IsIterableWithSize.<EndResult<Content>>.iterableWithSize(1));
これらは私の輸入品です:
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.collection.IsCollectionWithSize.hasSize; import static org.hamcrest.collection.IsIterableWithSize.iterableWithSize; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import org.hamcrest.collection.IsIterableWithSize;
コレクションの hasSize は期待どおりに機能しますが、イテレータの場合は実際の例を見つけることさえできません...