// Path: src/main/java/com/hadisatrio/optional/function/Function.java
// public interface Function {
// 
//     void call();
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/LongConsumer.java
// public interface LongConsumer {
// 
//     void consume(long value);
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/LongSupplier.java
// public interface LongSupplier {
// 
//     long get();
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/Supplier.java
// public interface Supplier<T> {
// 
//     T get();
// }


import com.hadisatrio.optional.function.Function;
import com.hadisatrio.optional.function.LongConsumer;
import com.hadisatrio.optional.function.LongSupplier;
import com.hadisatrio.optional.function.Supplier;
import org.junit.Assert;
import org.junit.Test;

    @Test
    public void ifPresent() throws Exception {
        OptionalLong.of(42l).ifPresent(new LongConsumer() {
            @Override
            public void consume(long value) {
                Assert.assertEquals(42l, value);
            }
        });

        OptionalLong.absent().ifPresent(new LongConsumer() {
            @Override
            public void consume(long value) {
                Assert.fail("ifPresent() on an absent optional should never call its consumer");
            }
        });
    }

    @Test
    public void ifPresentOrElse() throws Exception {
        OptionalLong.of(42l).ifPresentOrElse(new LongConsumer() {
            @Override
            public void consume(long value) {
                Assert.assertEquals(42l, value);
            }
        }, new Function() {
            @Override
            public void call() {
                Assert.fail("ifPresent() on an non-absent optional should call its consumer");
            }
// Path: src/main/java/com/hadisatrio/optional/function/Function.java
// public interface Function {
// 
//     void call();
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/LongConsumer.java
// public interface LongConsumer {
// 
//     void consume(long value);
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/LongSupplier.java
// public interface LongSupplier {
// 
//     long get();
// }
// 
// Path: src/main/java/com/hadisatrio/optional/function/Supplier.java
// public interface Supplier<T> {
// 
//     T get();
// }


// Path: src/test/java/com/hadisatrio/optional/OptionalLongTest.java
import com.hadisatrio.optional.function.Function;
import com.hadisatrio.optional.function.LongConsumer;
import com.hadisatrio.optional.function.LongSupplier;
import com.hadisatrio.optional.function.Supplier;
import org.junit.Assert;
import org.junit.Test;


    @Test
    public void ifPresent() throws Exception {
        OptionalLong.of(42l).ifPresent(new LongConsumer() {
            @Override
            public void consume(long value) {
                Assert.assertEquals(42l, value);
            }
        });

        OptionalLong.absent().ifPresent(new LongConsumer() {
            @Override
            public void consume(long value) {
                Assert.fail("ifPresent() on an absent optional should never call its consumer");
            }
        });
    }

    @Test
    public void ifPresentOrElse() throws Exception {
        OptionalLong.of(42l).ifPresentOrElse(new LongConsumer() {
            @Override
            public void consume(long value) {
                Assert.assertEquals(42l, value);
            }
        }, new Function() {
            @Override
            public void call() {
                Assert.fail("ifPresent() on an non-absent optional should call its consumer");
            }
        });