### Question:
LuceneIndexValueValidator implements Validator<Value> { @Override public void validate( Value value ) { textValueValidator.validate( value ); if ( Values.isArrayValue( value ) ) { textValueValidator.validate( ArrayEncoder.encode( value ).getBytes() ); } } private  LuceneIndexValueValidator(); @Override void validate( Value value ); void validate( byte[] encodedValue ); static final LuceneIndexValueValidator INSTANCE; }### Answer:
@Test void tooLongArrayIsNotAllowed() { int length = MAX_TERM_LENGTH + 1; IllegalArgumentException iae = assertThrows( IllegalArgumentException.class, () -> getValidator().validate( RandomUtils.nextBytes( length ) ) ); assertThat( iae.getMessage(), containsString( "Property value size is too large for index. Please see index documentation for limitations." ) ); }
@Test void stringOverExceedLimitNotAllowed() { int length = MAX_TERM_LENGTH * 2; IllegalArgumentException iae = assertThrows( IllegalArgumentException.class, () -> getValidator().validate( RandomStringUtils.randomAlphabetic( length ) ) ); assertThat( iae.getMessage(), containsString( "Property value size is too large for index. Please see index documentation for limitations." ) ); }
@Test void nullIsNotAllowed() { IllegalArgumentException iae = assertThrows( IllegalArgumentException.class, () -> getValidator().validate( null ) ); assertEquals( iae.getMessage(), "Null value" ); }
@Test void numberIsValidValue() { getValidator().validate( 5 ); getValidator().validate( 5.0d ); getValidator().validate( 5.0f ); getValidator().validate( 5L ); }
@Test void shortArrayIsValidValue() { getValidator().validate( new long[] {1, 2, 3} ); getValidator().validate( RandomUtils.nextBytes( 200 ) ); }
@Test void shortStringIsValidValue() { getValidator().validate( RandomStringUtils.randomAlphabetic( 5 ) ); getValidator().validate( RandomStringUtils.randomAlphabetic( 10 ) ); getValidator().validate( RandomStringUtils.randomAlphabetic( 250 ) ); getValidator().validate( RandomStringUtils.randomAlphabetic( 450 ) ); getValidator().validate( RandomStringUtils.randomAlphabetic( MAX_TERM_LENGTH ) ); }