// Path: src/main/java/javafixes/object/Either.java
// public static <L, R> Either<L, R> left(L value) {
//     return new Either.Left<>(value);
// }
// 
// Path: src/main/java/javafixes/object/Either.java
// public static <L, R> Either<L, R> right(R value) {
//     return new Either.Right<>(value);
// }
// 
// 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.junit.Test;
import java.math.BigDecimal;
import java.util.NoSuchElementException;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import static java.util.UUID.randomUUID;
import static javafixes.object.Either.left;
import static javafixes.object.Either.right;
import static javafixes.test.Random.randomInt;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
                }
        );
        assertThat(mappedEither, equalTo(right(value + "-" + value)));
        assertThat(leftCallCount.get(), is(0));
        assertThat(rightCallCount.get(), is(1));

        // mapLeft

        leftCallCount.set(0);
        Either<BigDecimal, UUID> leftMappedEither = either.mapLeft(leftValue -> {
            leftCallCount.incrementAndGet();
            return BigDecimal.valueOf(leftValue + 5);
        });
        assertThat(leftMappedEither, equalTo(right(value)));
        assertThat(leftCallCount.get(), is(0));

        // mapRight

        rightCallCount.set(0);
        Either<Integer, String> rightMappedEither = either.mapRight(rightValue -> {
            rightCallCount.incrementAndGet();
            return rightValue + "-" + rightValue;
        });
        assertThat(rightMappedEither, equalTo(right(value + "-" + value)));
        assertThat(rightCallCount.get(), is(1));

        // fold

        leftCallCount.set(0);
        rightCallCount.set(0);
// Path: src/main/java/javafixes/object/Either.java
// public static <L, R> Either<L, R> left(L value) {
//     return new Either.Left<>(value);
// }
// 
// Path: src/main/java/javafixes/object/Either.java
// public static <L, R> Either<L, R> right(R value) {
//     return new Either.Right<>(value);
// }
// 
// 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/object/EitherTest.java
import org.junit.Test;
import java.math.BigDecimal;
import java.util.NoSuchElementException;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import static java.util.UUID.randomUUID;
import static javafixes.object.Either.left;
import static javafixes.object.Either.right;
import static javafixes.test.Random.randomInt;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

                }
        );
        assertThat(mappedEither, equalTo(right(value + "-" + value)));
        assertThat(leftCallCount.get(), is(0));
        assertThat(rightCallCount.get(), is(1));

        // mapLeft

        leftCallCount.set(0);
        Either<BigDecimal, UUID> leftMappedEither = either.mapLeft(leftValue -> {
            leftCallCount.incrementAndGet();
            return BigDecimal.valueOf(leftValue + 5);
        });
        assertThat(leftMappedEither, equalTo(right(value)));
        assertThat(leftCallCount.get(), is(0));

        // mapRight

        rightCallCount.set(0);
        Either<Integer, String> rightMappedEither = either.mapRight(rightValue -> {
            rightCallCount.incrementAndGet();
            return rightValue + "-" + rightValue;
        });
        assertThat(rightMappedEither, equalTo(right(value + "-" + value)));
        assertThat(rightCallCount.get(), is(1));

        // fold

        leftCallCount.set(0);
        rightCallCount.set(0);
        int randomIncrement = randomInt(-100, 100);