### Question:
StringEncoder implements Encoder { @Override public long encode( Object s ) { int[] val = encodeInt( (String) s ); return (long) val[0] << 32 | val[1] & UPPER_INT_MASK; } StringEncoder();  StringEncoder( int codingStrength ); @Override long encode( Object s ); @Override String toString();  }### Answer:
@Test public void shouldEncodeStringWithZeroLength() { Encoder encoder = new StringEncoder(); long eId = encoder.encode( "" ); assertTrue( eId != 0 ); }
@Test public void shouldEncodeStringWithAnyLength() { Encoder encoder = new StringEncoder(); MutableLongSet encoded = new LongHashSet(); int total = 1_000; int duplicates = 0; for ( int i = 0; i < total; i++ ) { long encode = encoder.encode( abcStringOfLength( i ) ); assertTrue( encode != 0 ); if ( !encoded.add( encode ) ) { duplicates++; } } assertTrue( ((float) duplicates / (float) total) < 0.01f ); }