@Test
public void overlongString() {

  // Max string length is 31 characters
  final String maxlengthString = "1234567890123456789012345678901";
  final String overlongString = maxlengthString + "X";
  
  MyAttributeEncodingFactory.parseValueFromEncoding(ENCODING_STRING_UTF_8, maxlengthString, null);
  try {
    MyAttributeEncodingFactory.parseValueFromEncoding(ENCODING_STRING_UTF_8, overlongString, null);
    fail("Expected an exception due to overlong string");
  } catch(RuntimeException e) {
    // expected
    assertTrue(e.getMessage().contains("too long"));
  }
}