### Question:
ArrayEncoder { public static String encode( Value array ) { if ( !Values.isArrayValue( array ) ) { throw new IllegalArgumentException( "Only works with arrays" ); } ValueEncoder encoder = new ValueEncoder(); array.writeTo( encoder ); return encoder.result(); } private  ArrayEncoder(); static String encode( Value array );  }### Answer:
@Test public void encodingShouldContainOnlyBase64EncodingChars() { String[] array = { "This string is long enough for BASE64 to emit a line break, making the encoding platform dependant.", "Something else to trigger padding." }; String encoded = ArrayEncoder.encode( Values.of( array ) ); int separators = 0; boolean padding = false; for ( int i = 0; i < encoded.length(); i++ ) { char character = encoded.charAt( i ); if ( character == ARRAY_ENTRY_SEPARATOR ) { padding = false; separators++; } else if ( padding ) { assertEquals( PADDING, character ); } else if ( character == PADDING ) { padding = true; } else { assertTrue( "Char " + character + " at position " + i + " is not a valid Base64 encoded char", ArrayUtil.contains( base64chars, character ) ); } } assertEquals( array.length, separators ); }