// Path: src/test/java/javafixes/test/Random.java
// @SafeVarargs
// public static int randomInt(int from, int to, Function<Integer, Boolean>... validityConditions) {
//     return generateValidValue(
//             // typecast it to long as otherwise we could get int overflow
//             () -> (int) ((long) (Math.random() * ((long) to - (long) from + 1L)) + (long) from),
//             validityConditions
//     );
// }


import org.apache.commons.io.IOUtils;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import static java.util.UUID.randomUUID;
import static javafixes.test.Random.randomInt;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
package javafixes.io;




public class ByteCollectingOutputStreamTest {

    @Test
    public void shouldCollectBytes() throws IOException {
        String text = "This is a random string " + randomUUID() + " with some random " + randomUUID() + " values in it";
        String charsetName = "UTF-8";

// Path: src/test/java/javafixes/test/Random.java
// @SafeVarargs
// public static int randomInt(int from, int to, Function<Integer, Boolean>... validityConditions) {
//     return generateValidValue(
//             // typecast it to long as otherwise we could get int overflow
//             () -> (int) ((long) (Math.random() * ((long) to - (long) from + 1L)) + (long) from),
//             validityConditions
//     );
// }


// Path: src/test/java/javafixes/io/ByteCollectingOutputStreamTest.java
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import static java.util.UUID.randomUUID;
import static javafixes.test.Random.randomInt;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

package javafixes.io;




public class ByteCollectingOutputStreamTest {

    @Test
    public void shouldCollectBytes() throws IOException {
        String text = "This is a random string " + randomUUID() + " with some random " + randomUUID() + " values in it";
        String charsetName = "UTF-8";

        ByteCollectingOutputStream stream = new ByteCollectingOutputStream(randomInt(1, 20));