Integer getMaxSize( Collection<BeanInjectionInfo.Property> properties, Object obj ) {
    int max = Integer.MIN_VALUE;

    for ( BeanInjectionInfo.Property property: properties ) {
      max = Math.max( max,
        ( isCollection( property )
          ? getCollectionSize( property, obj )
          // if not collection then field of length one
          : 1 ) );
    }

    return ( max != Integer.MIN_VALUE ) ? max : null;
  }
@Test
  public void getMaxSize_Collections() {
    BeanInjector bi = new BeanInjector(null );
    BeanInjectionInfo bii = new BeanInjectionInfo( MetaBeanLevel1.class );
    MetaBeanLevel1 mbl1 = new MetaBeanLevel1();
    mbl1.setSub( new MetaBeanLevel2() );
    mbl1.getSub().setFilenames( new String[] { "file1", "file2", "file3"} );
    mbl1.getSub().setAscending( Arrays.asList( new Boolean[] { true, false, false, true} ) );
    mbl1.getSub().setSeparator( "/" );

    assertEquals(new Integer(4 ), bi.getMaxSize( bii.getProperties().values(), mbl1.getSub() ) );
  }