### Question:
SystemCodeFindAllInternalBySystemCodeValuesKeyGenerator implements KeyGenerator { @Override @Nonnull public Object generate( @Nonnull Object target, @Nonnull Method method, @Nonnull Object... params ) { @SuppressWarnings( "unchecked" ) final Collection<String> internalSystemUris = (Collection<String>) params[0]; @SuppressWarnings( "unchecked" ) final Collection<String> otherSystemCodes = (Collection<String>) params[1]; final StringBuilder sb = new StringBuilder( "findAllInternalBySystemCodeValues," ); sb.append( internalSystemUris.size() ); sb.append( ',' ); sb.append( otherSystemCodes.size() ); for ( final String value : new TreeSet<>( internalSystemUris ) ) { sb.append( ',' ).append( value ); } for ( final String value : new TreeSet<>( otherSystemCodes ) ) { sb.append( ',' ).append( value ); } return sb.toString(); }  @Override @Nonnull Object generate( @Nonnull Object target, @Nonnull Method method, @Nonnull Object... params );  }### Answer:
@Test public void test() throws NoSuchMethodException { final List<String> internalUris = Arrays.asList( "test123", "abc123", "def123" ); final List<String> otherSystemCodes = Arrays.asList( "other|xyz", "abc|def", "xyz|abc" ); final Object key = generator.generate( target, generator.getClass().getMethod( "toString" ), internalUris, otherSystemCodes ); Assert.assertEquals( "findAllInternalBySystemCodeValues,3,3,abc123,def123,test123,abc|def,other|xyz,xyz|abc", key ); }