@Test(expected = IllegalArgumentException.class)
  public void shouldFailValidationWithBinaryTooLong() {
    StringUtils.validateKey(tooLongKey, true);
  }
A dummy key which is longer than allowed.
src/test/java/net/spy/memcached/util/StringUtilsTest.java