public static int nrSpacesBefore( String field ) {
    int nr = 0;
    int len = field.length();
    while ( nr < len && field.charAt( nr ) == ' ' ) {
      nr++;
    }
    return nr;
  }
@Test
  public void testNrSpacesBefore() {
    try {
      Const.nrSpacesBefore( null );
      fail( "Expected NullPointerException" );
    } catch ( NullPointerException ex ) {
      // Ignore
    }

    assertEquals( 0, Const.nrSpacesBefore( "" ) );
    assertEquals( 1, Const.nrSpacesBefore( " " ) );
    assertEquals( 3, Const.nrSpacesBefore( "   " ) );
    assertEquals( 0, Const.nrSpacesBefore( "test" ) );
    assertEquals( 0, Const.nrSpacesBefore( "test  " ) );
    assertEquals( 3, Const.nrSpacesBefore( "   test" ) );
    assertEquals( 4, Const.nrSpacesBefore( "    test  " ) );
  }