@Test
public void testUnsignedIntegerParsing() {

  int val = CharSequences.parseUnsignedInt("  1234  ", 10, 2);
  Assert.assertEquals(1234, val);
  val = CharSequences.parseUnsignedInt("  " + Integer.MAX_VALUE + "  ", 10, 2);
  Assert.assertEquals(Integer.MAX_VALUE, val);
  try {
    CharSequences.parseUnsignedInt("  " + Integer.MAX_VALUE + "1  ", 10, 2);
    Assert.fail();
  } catch (NumberFormatException ex) {
    // expected
  }
}