@Override public String toString() { return collectionProperty + " contains " + Iterables.toList( valueCollection ); } }
@Test public void script16() throws EntityFinderException { // should return only 2 entities final List<EntityReference> references = toList( entityFinder.findEntities( Nameable.class, ALL, NO_SORTING, NO_FIRST_RESULT, 2, NO_VARIABLES ) ); assertEquals( "2 identitities", 2, references.size() ); }
@Test public void script17() throws EntityFinderException { // should return only 2 entities starting with third one final List<EntityReference> references = toList( entityFinder.findEntities( Nameable.class, ALL, NO_SORTING, 3, 2, NO_VARIABLES ) ); assertEquals( "2 identitities", 2, references.size() ); }
public static void assertNames( boolean sort, Iterable<EntityReference> identitiesIterable, String... expectedNames ) { final List<EntityReference> references = toList( identitiesIterable ); assertThat( expectedNames.length + " entries(" + expectedNames.length + ", got " + getNames( references ) + ")", references.size(), equalTo( expectedNames.length ) ); List<String> sortedNames = getNames( references ); final List<String> expectedSorted = java.util.Arrays.asList( expectedNames ); if( sort ) { Collections.sort( sortedNames ); Collections.sort( expectedSorted ); } assertThat( "names", sortedNames, equalTo( expectedSorted ) ); }
public static Specification<ApplicationEvent> withNames( final Class eventClass ) { return ApplicationEvents.withNames( Iterables.map( new Function<Method, String>() { @Override public String map( Method method ) { return method.getName(); } }, Iterables.toList( Methods.METHODS_OF.map( eventClass ) ) )); }
public static Specification<DomainEventValue> withNames( final Class eventClass ) { return Events.withNames( map( new Function<Method, String>() { @Override public String map( Method method ) { return method.getName(); } }, Iterables.toList( Methods.METHODS_OF.map( eventClass ) ) )); }